Ejemplo n.º 1
0
             $htaccess_changed = TRUE;
             break;
         }
     }
 }
 if ($htaccess_changed) {
     output("Your " . $htaccess_path . " needs to be updated.\n");
 }
 $ask_rewrite->ask();
 $rewrite_base = $ask_rewrite->get_answer();
 if (is_string($rewrite_base)) {
     $rewrite_base = rtrim($rewrite_base, "/") . "/";
     $ask_rewrite->set_answer($rewrite_base);
 }
 $ask_update = new ConfigEntry("update.htaccess", "YesNo", "Update " . $htaccess_path . " ?", NULL, "yes");
 if ($htaccess_changed || $ask_rewrite->get_answer() !== $ask_rewrite->get_config_answer()) {
     $ask_update->ask();
 }
 if ($ask_update->get_answer() === "yes") {
     if (!copy($htaccess_template_path, $htaccess_path)) {
         output("Error: could not update " . $htaccess_path . "\n");
         exit(1);
     }
     $htaccess = file($htaccess_path);
     for ($i = count($htaccess) - 1; $i >= 0; $i--) {
         $match = array();
         if (preg_match("#^([ \t]*RewriteBase[ \t]*)([^ \t]*)[ \t]*\$#", $htaccess[$i], $match) < 1) {
             continue;
         }
         $htaccess[$i] = $match[1] . $rewrite_base . "\n";
         break;