*/ $task = str_replace("\"", null, $task); $data = explode(" ", $task); $elem = array_shift($data); //delete first element run_addon_core_install($data); } try { if (isset($_REQUEST["action"])) { $action = $_REQUEST["action"]; } else { throw new Exception("Action undefined"); } if (isset($_REQUEST['addon']) && isset($_REQUEST['store'])) { require_once PATH_CORE . 'classes/model/AddonsManagerPeer.php'; $addon = AddonsManagerPeer::retrieveByPK($_REQUEST['addon'], $_REQUEST['store']); $addonId = $_REQUEST['addon']; $storeId = $_REQUEST['store']; if ($addon === null) { throw new Exception("Unable to find addon (id: '{$_REQUEST['addon']}', store: '{$_REQUEST['store']}')"); } } else { $addon = null; } $result = array(); switch (strtolower($action)) { case "importlicense": if (sizeof($_FILES) > 0) { $aInfoLoadFile = $_FILES["upLicense"]; $aExtentionFile = explode(".", $aInfoLoadFile["name"]); //validating the extention before to upload it
function run_addon_core_install($args) { try { if (!extension_loaded("mysql")) { if (strtoupper(substr(PHP_OS, 0, 3)) === "WIN") { dl("mysql.dll"); } else { dl("mysql.so"); } } /////// /* if (!CLI2) { $args = $opts; } */ $workspace = $args[0]; $storeId = $args[1]; $addonName = $args[2]; if (!defined("SYS_SYS")) { define("SYS_SYS", $workspace); } if (!defined("PATH_DATA_SITE")) { define("PATH_DATA_SITE", PATH_DATA . "sites/" . SYS_SYS . "/"); } if (!defined("DB_ADAPTER")) { define("DB_ADAPTER", $args[3]); } /////// //***************** Plugins ************************** G::LoadClass("plugin"); //Here we are loading all plugins registered //the singleton has a list of enabled plugins $sSerializedFile = PATH_DATA_SITE . "plugin.singleton"; $oPluginRegistry =& PMPluginRegistry::getSingleton(); if (file_exists($sSerializedFile)) { $oPluginRegistry->unSerializeInstance(file_get_contents($sSerializedFile)); } /////// //echo "** Installation starting... (workspace: $workspace, store: $storeId, id: $addonName)\n"; $ws = new workspaceTools($workspace); $ws->initPropel(false); require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php'; require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AddonsManagerPeer.php'; $addon = AddonsManagerPeer::retrieveByPK($addonName, $storeId); if ($addon == null) { throw new Exception("Id {$addonName} not found in store {$storeId}"); } //echo "Downloading...\n"; $download = $addon->download(); //echo "Installing...\n"; $addon->install(); if ($addon->isCore()) { $ws = new workspaceTools($workspace); $ws->initPropel(false); $addon->setState("install-finish"); } else { $addon->setState(); } } catch (Exception $e) { $addon->setState("error"); //fwrite(STDERR, "\n[ERROR: {$e->getMessage()}]\n"); //fwrite(STDOUT, "\n[ERROR: {$e->getMessage()}]\n"); } //echo "** Installation finished\n"; }