/**
  * Get composer.json contents from a zip file.
  *
  * @param string $file Path to the zip file
  * @return string Returns the content of the composer.json
  */
 protected function get_composer_json($file)
 {
     $path = $this->package->set_source($file)->set_temp_path($this->ext_config->__get('contrib_temp_path'), true)->extract()->find_directory(array('files' => array('required' => 'composer.json')), 'vendor');
     $composer_json = '';
     if ($path !== null) {
         $composer_json = file_get_contents($this->package->get_temp_path() . '/' . $path . '/composer.json');
     }
     $this->package->cleanup();
     return $composer_json;
 }
示例#2
0
 /**
  * @{inheritDoc}
  */
 public function install_demo(\titania_contribution $contrib, \titania_revision $revision)
 {
     $revision->load_phpbb_versions();
     $attachment = $revision->get_attachment();
     $branch = $revision->phpbb_versions[0]['phpbb_version_branch'];
     $package = new package();
     $package->set_source($attachment->get_filepath())->set_temp_path($this->ext_config->__get('contrib_temp_path'), true);
     $demo_url = '';
     if ($this->demo_manager->configure($branch, $contrib, $package)) {
         $result = $this->demo_manager->install();
         if (empty($result['error'])) {
             $demo_url = $this->demo_manager->get_demo_url($branch, $result['id']);
             $contrib->set_demo_url($branch, $demo_url);
             $contrib->submit();
         }
     }
     $package->cleanup();
     return $demo_url;
 }
示例#3
0
 /**
  * Generate Composer package.
  *
  * @param string $composer_package Path to package destination
  */
 protected function generate_composer_package($composer_package)
 {
     $package = new package();
     $package->set_source($this->ext_config->upload_path . $this->file['physical_filename']);
     $package->set_temp_path($this->ext_config->contrib_temp_path, true);
     $ext_base_path = $package->find_directory(array('files' => array('required' => 'composer.json', 'optional' => 'ext.php')), 'vendor');
     $package->restore_root($ext_base_path, $this->id);
     $filesystem = new Filesystem();
     $filesystem->copy($package->get_source(), $this->ext_config->upload_path . $composer_package);
     $package->set_source($package->get_source() . '.composer');
     $package->repack(true);
     $package->cleanup();
 }
示例#4
0
 /**
  * Load revision package.
  */
 protected function load_package()
 {
     $this->package = new \phpbb\titania\entity\package();
     $this->package->set_source($this->attachment->get_filepath())->set_temp_path($this->ext_config->__get('contrib_temp_path'), true);
 }