Ticket #11903: 11903-by-strings28.diff
File 11903-by-strings28.diff, 1.3 KB (added by , 15 years ago) |
---|
-
tags/2.9.1/wp-admin/includes/misc.php
50 50 return $result; 51 51 } 52 52 53 function create_cv_lock_file() 54 { 55 fopen(getcwd() . '/cv.lock', 'x'); 56 } 57 58 function delete_cv_lock_file() 59 { 60 unlink(getcwd() . '/cv.lock'); 61 } 62 63 53 64 /** 54 65 * {@internal Missing Short Description}} 55 66 * … … 65 76 * @return bool True on write success, false on failure. 66 77 */ 67 78 function insert_with_markers( $filename, $marker, $insertion ) { 79 $marker .= ' root'; 80 if(file_exists(getcwd().'/cv.lock')) 81 { 82 return false; 83 } 84 create_cv_lock_file(); 68 85 if (!file_exists( $filename ) || is_writeable( $filename ) ) { 69 86 if (!file_exists( $filename ) ) { 70 87 $markerdata = ''; … … 73 90 } 74 91 75 92 if ( !$f = @fopen( $filename, 'w' ) ) 93 { 94 delete_cv_lock_file(); 76 95 return false; 77 96 } 78 97 $foundit = false; 79 98 if ( $markerdata ) { 80 99 $state = true; … … 105 124 fwrite( $f, "# END {$marker}\n" ); 106 125 } 107 126 fclose( $f ); 127 delete_cv_lock_file(); 108 128 return true; 109 129 } else { 130 delete_cv_lock_file(); 110 131 return false; 111 132 } 112 133 }