gyro/modules/systemupdate/install/updates/0001_extend_htaccess.php File Reference
Go to the source code of this file.
Functions |
|
systemupdate_update_1 () |
Function Documentation
systemupdate_update_1 | ( | ) |
Definition at line 2 of file 0001_extend_htaccess.php.
00002 { 00003 $ret = new Status(); 00004 $htaccess = Config::get_value(Config::URL_ABSPATH) . '.htaccess'; 00005 if (file_exists($htaccess)) { 00006 $c = file_get_contents($htaccess); 00007 if (strpos($c, '### BEGIN OPTIONS') === false) { 00008 $c = str_replace('RewriteEngine On', "### BEGIN OPTIONS ###\n\n### END OPTIONS ###\n\nRewriteEngine On", $c); 00009 } 00010 if (strpos($c, '### BEGIN REWRITE') === false) { 00011 $c = str_replace('RewriteBase /', "RewriteBase /\n\n### BEGIN REWRITE ###\n\n### END REWRITE ###\n", $c); 00012 } 00013 if (file_put_contents($htaccess, $c) === false) { 00014 $ret->append('Could not update .htaccess'); 00015 } 00016 } 00017 else { 00018 $ret->append(".htaccess not found at $htaccess"); 00019 } 00020 return $ret; 00021 }