/**
  * [doFetchUpdates description]
  * @return [type] [description]
  */
 public function doFetchUpdates()
 {
     // Pull Projects
     $projects = update_get_projects();
     // Fetch Updates
     foreach ($projects as $project) {
         $res = _update_process_fetch_task($project);
     }
 }
Beispiel #2
0
 /**
  * @param string $extension
  *
  * @return array Context result generated by Drupal.
  *
  * @throws Oxygen_Exception
  *
  * @see update_authorize_run_update()
  */
 public function updateExtension($extension)
 {
     module_load_include('inc', 'update', 'update.manager');
     drupal_get_updaters();
     $directory = _update_manager_extract_directory();
     $projectLocation = $directory . '/' . $extension;
     $updater = Updater::factory($projectLocation);
     $projectRealLocation = drupal_realpath($projectLocation);
     // If the owner of the directory we extracted is the same as the
     // owner of our configuration directory (e.g. sites/default) where we're
     // trying to install the code, there's no need to prompt for FTP/SSH
     // credentials. Instead, we instantiate a FileTransferLocal and invoke
     // update_authorize_run_install() directly.
     if (fileowner($projectRealLocation) !== fileowner(DRUPAL_ROOT . '/' . conf_path())) {
         throw new Oxygen_Exception(Oxygen_Exception::PROJECT_MANAGER_FILE_SYSTEM_NOT_WRITABLE, array('projectOwner' => fileowner($projectRealLocation), 'siteOwner' => fileowner(conf_path())));
     }
     module_load_include('inc', 'update', 'update.authorize');
     // @TODO: Implement other file transfer types.
     $fileTransfer = new FileTransferLocal(DRUPAL_ROOT);
     update_authorize_batch_copy_project($extension, get_class($updater), $projectRealLocation, $fileTransfer, $context);
     // Reset the cache for this extension only, so we may immediately update the dashboard.
     // Hacky way to do it, but most efficient.
     module_load_include('inc', 'update', 'update.fetch');
     module_load_include('inc', 'update', 'update.compare');
     _update_cache_clear('update_project_projects');
     _update_cache_clear('update_project_data');
     $projects = update_get_projects();
     _update_process_fetch_task($projects[$extension]);
     return $context;
 }