private function upgrade_system() { $tool_dir = dirname(__FILE__) . '/../../'; $tool_dir = realpath($tool_dir); // Get version data $source = $this->spark_sources[0]; if (!$source) { throw new Spark_exception('No sources listed - unsure how to upgrade'); } if (!$source->outdated()) { Spark_utils::warning('Spark manager is already up to date'); return; } // Build a spark and download it $data = null; $data->name = 'Spark Manager'; $data->archive_url = $source->version_data->spark_manager_download_url; $zip_spark = new Zip_spark($data); $zip_spark->retrieve(); // Download the new version // Remove the lib directory and the spark unlink($tool_dir . '/spark'); Spark_utils::remove_full_directory($tool_dir . '/lib'); // Link up the new version Spark_utils::full_move($zip_spark->temp_path . '/lib', $tool_dir . '/lib'); @rename($zip_spark->temp_path . '/spark', $tool_dir . '/spark'); @`chmod u+x {$tool_dir}/spark`; // Tell the user the story of what just happened Spark_utils::notice('Spark manager has been upgraded to ' . $source->version . '!'); }
function install() { foreach ($this->dependencies as $dependency) { if ($dependency->is_direct) { $this->install_dependency($dependency); } } @mkdir(SPARK_PATH); // Two steps for windows @mkdir(SPARK_PATH . "/{$this->name}"); Spark_utils::full_move($this->temp_path, $this->installation_path); Spark_utils::remove_full_directory($this->temp_path); $this->installed_path = $this->installation_path; }