Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Remove upgrade from 3.2.4 functions
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Nov 11, 2014
1 parent 494f159 commit 9ba80b4
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 366 deletions.
315 changes: 0 additions & 315 deletions core/src/plugins/action.updater/class.AjaXplorerUpgrader.php
Expand Up @@ -393,321 +393,6 @@ public function displayUpgradeInstructions()
}
}


public static function upgradeFrom324($oldLocation, $dryRun = true)
{
$mess = ConfService::getMessages();
$logFile = AJXP_CACHE_DIR."/import_from_324.log";
if ($dryRun) {
print("<b>".$mess["updater.10"]."</b><br><br>");
}

$itemsToCopy = array(
array(
"mask" => "public/*.php",
"target" => "data/public"
),
array(
"mask" => "public/.ajxp_publiclet_counters.ser",
"target" => "data/public"
),
array(
"mask" => "server/logs/*.txt",
"target" => "data/logs"
),
array(
"mask" => "server/conf/repo.ser",
"target" => "data/plugins/conf.serial"
),
array(
"mask" => "server/conf/aliases.ser",
"target" => "data/plugins/conf.serial"
),
array(
"mask" => "server/users/*",
"target" => "data/plugins/auth.serial"
)
);

$configToPluginsConf = array(
array(
"type" => "constant",
"name" => "ENABLE_USERS",
"target" => "core.auth/ENABLE_USERS"
),
array(
"type" => "constant",
"name" => "ALLOW_GUEST_BROWSING",
"target" => "core.auth/ALLOW_GUEST_BROWSING"
),
array(
"type" => "constant",
"name" => "AJXP_PASSWORD_MINLENGTH",
"target" => "core.auth/PASSWORD_MINLENGTH"
),
array(
"type" => "variable",
"name" => "AJXP_SESSION_SET_CREDENTIALS",
"target" => "core.auth/SESSION_SET_CREDENTIALS"
),
array(
"type" => "constant",
"name" => "PUBLIC_DOWNLOAD_FOLDER",
"target" => "core.ajaxplorer/PUBLIC_DOWNLOAD_FOLDER"
),
array(
"type" => "constant",
"name" => "PUBLIC_DOWNLOAD_URL",
"target" => "core.ajaxplorer/PUBLIC_DOWNLOAD_URL"
),
array(
"type" => "variable",
"name" => "default_language",
"target" => "core.ajaxplorer/DEFAULT_LANGUAGE"
),
array(
"type" => "constant",
"name" => "GZIP_DOWNLOAD",
"target" => "core.ajaxplorer/GZIP_COMPRESSION"
),
array(
"type" => "constant",
"name" => "GZIP_LIMIT",
"target" => "core.ajaxplorer/GZIP_LIMIT"
),
array(
"type" => "constant",
"name" => "DISABLE_ZIP_CREATION",
"target" => "core.ajaxplorer/ZIP_CREATION",
"modifier" => "NOT"
),
array(
"type" => "constant",
"name" => "AJXP_WEBDAV_ENABLE",
"target" => "core.ajaxplorer/WEBDAV_ENABLE"
),
array(
"type" => "constant",
"name" => "AJXP_WEBDAV_BASEURI",
"target" => "core.ajaxplorer/WEBDAV_BASEURI"
),
array(
"type" => "constant",
"name" => "AJXP_WEBDAV_BASEHOST",
"target" => "core.ajaxplorer/WEBDAV_BASEHOST"
),
array(
"type" => "constant",
"name" => "AJXP_WEBDAV_DIGESTREALM",
"target" => "core.ajaxplorer/WEBDAV_DIGESTREALM"
),
array(
"type" => "variable",
"name" => "webmaster_email",
"target" => "core.ajaxplorer/WEBMASTER_EMAIL"
),
array(
"type" => "variable",
"name" => "max_caracteres",
"target" => "core.ajaxplorer/NODENAME_MAX_LENGTH"
),
array(
"type" => "variable",
"name" => "customTitle",
"target" => "core.ajaxplorer/APPLICATION_TITLE"
),
array(
"type" => "constant",
"name" => "HTTPS_POLICY_FILE",
"target" => "uploader.flex/HTTPS_POLICY_FILE"
),
array(
"type" => "variable",
"name" => "upload_max_number",
"target" => "core.uploader/UPLOAD_MAX_NUMBER"
),
array(
"type" => "variable",
"name" => "upload_max_size_per_file",
"target" => "core.uploader/UPLOAD_MAX_SIZE"
),
array(
"type" => "variable",
"name" => "upload_max_size_total",
"target" => "core.uploader/UPLOAD_MAX_SIZE_TOTAL"
),
array(
"type" => "constant",
"name" => "AJXP_CLIENT_TIMEOUT_TIME",
"target" => "gui.ajax/CLIENT_TIMEOUT_TIME"
),
array(
"type" => "constant",
"name" => "AJXP_CLIENT_TIMEOUT_WARN_BEFORE",
"target" => "gui.ajax/CLIENT_TIMEOUT_WARN"
),
array(
"type" => "constant",
"name" => "GOOGLE_ANALYTICS_ID",
"target" => "gui.ajax/GOOGLE_ANALYTICS_ID"
),
array(
"type" => "constant",
"name" => "GOOGLE_ANALYTICS_DOMAIN",
"target" => "gui.ajax/GOOGLE_ANALYTICS_DOMAIN"
),
array(
"type" => "constant",
"name" => "GOOGLE_ANALYTICS_EVENT",
"target" => "gui.ajax/GOOGLE_ANALYTICS_EVENT"
),
array(
"type" => "variable",
"name" => "customTitleFontSize",
"target" => "gui.ajax/CUSTOM_FONT_SIZE"
),
array(
"type" => "variable",
"name" => "customIcon",
"target" => "gui.ajax/CUSTOM_ICON"
),
array(
"type" => "variable",
"name" => "customIconWidth",
"target" => "gui.ajax/CUSTOM_ICON_WIDTH"
),
array(
"type" => "variable",
"name" => "welcomeCustomMessage",
"target" => "gui.ajax/CUSTOM_WELCOME_MESSAGE"
),
);

if (!$dryRun) {
$logFileHandle = fopen($logFile, "w");
}

foreach ($itemsToCopy as $item) {
$files = glob($oldLocation."/".$item["mask"]);
if($files === false) continue;
foreach ($files as $fileOrFolder) {
$target = AJXP_INSTALL_PATH."/".$item["target"];
if (is_file($fileOrFolder)) {
$l = "Copy $fileOrFolder to ".$target."/".basename($fileOrFolder)."\n";
if ($dryRun) {
print(nl2br($l));
} else {
copy($fileOrFolder, $target."/".basename($fileOrFolder));
fwrite($logFileHandle, $l);
}

} else {
$l= "Copy recursively ".$fileOrFolder." to ".$target."/".basename($fileOrFolder)."\n";
if ($dryRun) {
print(nl2br($l));
} else {
self::copy_r($fileOrFolder, $target."/".basename($fileOrFolder));
fwrite($logFileHandle, $l);
}
}
}
}

// FILTER THE CONF FILE TO REMOVE ALL CONSTANTS
$originalConfdir = $oldLocation."/server/conf";
$lines = file($originalConfdir."/conf.php");
$filteredLines = array();
$mutedConstants = array();
foreach ($lines as $line) {
if (preg_match('/define\("(.*)", (.*)\);/', $line, $matches)) {
//var_dump($matches);
$value = trim($matches[2]);
if (!empty($value)) {
if ($value[0] == "\"") {
$strValue = substr($value, 1, strlen($value)-2);
if (!empty($strValue)) {
$mutedConstants[$matches[1]] = $strValue;
}
} else if ($value == "true") {
$mutedConstants[$matches[1]] = true;
} else if ($value == "false") {
$mutedConstants[$matches[1]] = false;
} else if (is_numeric($value)) {
$mutedConstants[$matches[1]] = intval($value);
} else {
eval("\$res = $value;");
$mutedConstants[$matches[1]] = $res;
}
}
$filteredLines[] = "//".$line;
} else {
$filteredLines[] = $line;
}
}
if (!$dryRun) {
fwrite($logFileHandle, "Writing alternate version of conf.php without constants.");
}
file_put_contents($originalConfdir."/muted_conf.php", implode("", $filteredLines));

// NOW IMPORT THE MODIFIED CONF FILE AND GATHER ALL DATA
include $originalConfdir."/muted_conf.php";
$allOptions = array();
foreach ($configToPluginsConf as $localConfig) {
$localConfigName = $localConfig["name"];
if ($localConfig["type"] == "constant" && isset($mutedConstants[$localConfigName])) {
$localConfig["value"] = $mutedConstants[$localConfigName];
} else if ($localConfig["type"] == "variable" && isSet( $$localConfigName )) {
$localConfig["value"] = $$localConfigName;
}
if(!isSet($localConfig["value"]) || empty($localConfig["value"])) continue;
$l = "Should set ".$localConfig["target"]." to value ".$localConfig["value"]."\n";
if ($dryRun) {
$value = AJXP_Utils::xmlEntities($localConfig["value"]);
list($pluginId, $pluginOptionName) = explode("/", $localConfig["target"]);
$plug = AJXP_PluginsService::getInstance()->getPluginById($pluginId);
$options = $plug->getConfigs();
$options[$pluginOptionName] = $value;
print(nl2br($l));
} else {
list($pluginId, $pluginOptionName) = explode("/", $localConfig["target"]);
$confStorage = ConfService::getConfStorageImpl();
$value = AJXP_Utils::xmlEntities($localConfig["value"]);
if (!isSet($allOptions[$pluginId])) {
$plug = AJXP_PluginsService::getInstance()->getPluginById($pluginId);
$allOptions[$pluginId] = $plug->getConfigs();
} else {
$allOptions[$pluginId][$pluginOptionName] = $value;
}
fwrite($logFileHandle, $l);
}
}
if (!$dryRun && count($allOptions)) {
foreach ($allOptions as $pId => $pOptions) {
$confStorage->savePluginConfig($pId, $pOptions);
}
@unlink(AJXP_PLUGINS_CACHE_FILE);
@unlink(AJXP_PLUGINS_REQUIRES_FILE);
@unlink(AJXP_PLUGINS_MESSAGES_FILE);
}

foreach ($REPOSITORIES as $localRepoKey => $localRepoDef) {
$localRepoString = '$REPOSITORIES['.(is_numeric($localRepoKey)?$localRepoKey:'"'.$localRepoKey.'"').'] = '.str_replace(array("'", "\\\\"), array("\"","\\"), var_export($localRepoDef, true)).';';
$l = "Will print this to bootstrap_repositories : \n". $localRepoString;
if ($dryRun) {
print(nl2br($l));
} else {
file_put_contents($originalConfdir."/bootstrap_repositories.php", $localRepoString);
fwrite($logFileHandle, $l);
}
}

if (!$dryRun) {
fclose($logFileHandle);
print("<b>The operation is finished, all actions are logged in $logFile. Nothing was touch on your previous installation, please note that the repositories are not moved.<br>You should now logout, clear your browser cache, and refresh this page. Then you will log in with your previous users ids.</b>");
}

}

public static function migrateMetaSerialPlugin($repositoryId, $dryRun)
{
$repo = ConfService::getRepositoryById($repositoryId);
Expand Down
8 changes: 0 additions & 8 deletions core/src/plugins/action.updater/class.UpdateController.php
Expand Up @@ -77,14 +77,6 @@ public function switchAction($action, $httpVars, $fileVars)

switch ($action) {


case "import_from_324":

$dryRun = !isSet($httpVars["real_run"]);
AjaXplorerUpgrader::upgradeFrom324($httpVars["previous_location"], $dryRun);

break;

case "migrate_metaserial":

$dryRun = !isSet($httpVars["real_run"]);
Expand Down
43 changes: 0 additions & 43 deletions core/src/plugins/action.updater/manifest.xml
Expand Up @@ -97,49 +97,6 @@
<serverCallback methodName="switchAction"/>
</processing>
</action>
<action name="import_from_324">
<gui text="updater.5" title="updater.6" src="download_manager.png" hasAccessKey="false">
<context selection="false" dir="false" recycle="hidden" behaviour="hidden"
actionBar="true" contextMenu="false" infoPanel="false"
actionBarGroup="user" inZip="false">
</context>
</gui>
<processing>
<clientCallback prepareModal="true" dialogOpenForm="import_324_form" dialogOkButtonOnly="false" dialogSkipButtons="false">
<dialogOnOpen><![CDATA[
var startButton = $(oForm).down('div[id="start_upgrade_button"]');
startButton.observe("click", function(){
var conn = new Connexion();
conn.addParameter("get_action", "import_from_324");
conn.addParameter("previous_location", $(oForm).down('input[name="previous_location"]').value);
if($(oForm).down('div[id="start_upgrade_button"]').RUN_NOW){
conn.addParameter("real_run", "true");
}
conn.onComplete = function(transport){
$(oForm).down('div[id="upgrade_steps"]').update(transport.responseText);
$(oForm).down('div[id="start_upgrade_button"]').update(MessageHash['updater.9']);
$(oForm).down('div[id="start_upgrade_button"]').RUN_NOW = true;
};
conn.sendAsync();
});
]]></dialogOnOpen>
<dialogOnComplete hideDialog="true"><![CDATA[
$(oForm).down('div[id="start_upgrade_button"]').stopObserving("click");
]]></dialogOnComplete>
<dialogOnCancel><![CDATA[]]></dialogOnCancel>
</clientCallback>
<clientForm id="import_324_form"><![CDATA[
<div id="import_324_form" action="import_from_324" box_width="500">
<div id="upgrade_status">
<p><div id="start_upgrade_button" style="float: right;border: 1px solid #BBB;padding: 7px;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius: 5px;background-color: #EEE;color: #333;margin-left: 5px;border-image: initial;box-shadow: 1px 1px 7px #ddd;cursor: pointer;font-weight: bold;width: 80px;text-align: center;margin-bottom:10px;"> AJXP_MESSAGE[updater.7] </div>
AJXP_MESSAGE[updater.8] <input name="previous_location" placeholder="Your previous install location"></p>
<div id="upgrade_steps" style="height:250px;width:100%;overflow:auto;border:1px solid #ccc;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;"></div>
</div>
</div>
]]></clientForm>
<serverCallback methodName="switchAction"/>
</processing>
</action>
<action name="migrate_metaserial">
<gui text="updater.11" title="updater.12" src="download_manager.png" hasAccessKey="false">
<context selection="true" dir="false" recycle="hidden" behaviour="hidden"
Expand Down

0 comments on commit 9ba80b4

Please sign in to comment.