private static function globalRefresh() { Output::println('Start'); date_default_timezone_set('GMT'); // this is the time used in google feeds $newUpdateDate = gmdate(substr(DateTime::ATOM, 0, -1), strtotime('-1 hour')); // -1 hour because of the feeds delay. $rootFolderUrl = 'https://docs.google.com/feeds/default/private/full/folder%3A' . ROOT_FOLDER_ID . '/contents'; $menuTree = FolderScanner::scan($rootFolderUrl, ROOT_PATH); // Publish all pages and files Output::println('Done.'); $configPhpString = StringTools::serializeForInclude($newUpdateDate, $menuTree); Output::store($configPhpString, __DIR__ . '/config.php'); }
public static function init(array $args) { if (!is_array($args)) { throw new InvalidArgumentException('Argument 1 passed to Inferno::init() must be an array'); } // First parse the options and remove them // from the $args array $options = self::parse_options($args); // Parse the arguments $args = self::parse($args); if ($args['command'] == 'new_project') { if (is_dir(getcwd() . DIRECTORY_SEPARATOR . $args['name'])) { throw new InvalidArgumentException('A folder with the same name already exists'); } $location = __DIR__ . DIRECTORY_SEPARATOR . $args['name']; } else { if ($args['command'] != 'bootstrap') { $location = FolderScanner::check_location(); } else { // FIXME: Find a better solution // Set the location so that we don't get errors $location = ""; } } if ($args['command'] != 'bootstrap' && !$location) { $error_message = "No CodeIgniter project detected at your location.\n" . "You must either be in the root or the application folder" . " of a CodeIgniter project!"; throw new RuntimeException($error_message); } // FIXME: Make this more generic // Get the config $config = parse_ini_file(BASE_PATH . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . "{$args["command"]}.ini"); // Add the location to the configuration array. $config["location"] = $location; // Merge the config and args arrays $args = array_merge($config, $args); // Merge the options and args arrays $args = array_merge($args, $options); // Example: new Generate() // Example: new NewCommand() $command_class = ApplicationHelpers::camelize($args['command']); // Remove the command from the array. unset($args["command"]); $klass = 'FIRE_' . $command_class; // Finally, call and run the command. $process = new $klass($args); return $process->run(); }
/** * Revert the CodeIgniter Patch * * @access private * @return bool Whether or not CodeIgniter was unpatched * @author Aziz Light **/ private function unpatch_codeigniter() { $result = FALSE; foreach ($this->files_to_patch as $file) { $file_location = FolderScanner::system_path() . 'core' . DIRECTORY_SEPARATOR . $file . '.php'; $result = $this->unpatch_codeigniter_file($file_location); } return $result; }
/** * Revert the CodeIgniter Patch * @return void * @author Aziz Light **/ private function unpatch_codeigniter() { foreach ($this->files_to_patch as $file) { $file_location = FolderScanner::system_path() . 'core' . DIRECTORY_SEPARATOR . $file . '.php'; copy(BASE_PATH . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR . $file . '.php', $file_location); unlink(BASE_PATH . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR . $file . '.php'); } return; }