예제 #1
0
 /**
  * Dump runonce file after install or update command.
  *
  * @return void
  */
 public function dumpRunonce()
 {
     if (!$this->isProject) {
         return;
     }
     $this->runonceManager->dump();
 }
 /**
  * Adds runonce files of a package to the RunonceManager instance.
  *
  * @param PackageInterface $package The package being processed.
  *
  * @param array            $files   The file names of all runonce files.
  *
  * @return void
  */
 protected function addRunonces(PackageInterface $package, array $files)
 {
     $rootDir = $this->getInstallPath($package);
     foreach ($files as $file) {
         $this->runonceManager->addFile($this->filesystem->normalizePath($rootDir . '/' . $file));
     }
 }
예제 #3
0
파일: Plugin.php 프로젝트: Jobu/core
 /**
  * Handle post update events.
  *
  * @return void
  */
 public function handlePostUpdateCmd()
 {
     $package = $this->composer->getPackage();
     $root = $this->getContaoRoot($package);
     RunonceManager::createRunonce($this->inputOutput, $root);
     Housekeeper::cleanCache($this->inputOutput, $root);
 }
예제 #4
0
 /**
  * Create the spec list for legacy packages.
  *
  * @param string           $installPath The installation path.
  *
  * @param string           $startPath   The destination path.
  *
  * @param string           $currentPath The current working directory.
  *
  * @param array            $sources     The sources list.
  *
  * @param PackageInterface $package     The package being examined.
  *
  * @return void
  */
 protected function createLegacySourcesSpec($installPath, $startPath, $currentPath, &$sources, PackageInterface $package)
 {
     $sourcePath = self::unprefixPath($installPath . DIRECTORY_SEPARATOR, $currentPath);
     $targetPath = self::unprefixPath($startPath . DIRECTORY_SEPARATOR, $currentPath);
     if (self::getNativePath($targetPath, '/') == 'system/runonce.php') {
         $path = self::unprefixPath($this->plugin->getContaoRoot($this->composer->getPackage()), $currentPath);
         RunonceManager::addRunonce($path);
     } elseif (is_file($currentPath) || preg_match('#^system/modules/[^/]+$#', self::getNativePath($targetPath, '/'))) {
         $sources[$sourcePath] = $targetPath;
     } elseif (is_dir($currentPath)) {
         $files = new \FilesystemIterator($currentPath, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS | \FilesystemIterator::CURRENT_AS_PATHNAME);
         foreach ($files as $file) {
             $this->createLegacySourcesSpec($installPath, $startPath, $file, $sources, $package);
         }
     }
 }
예제 #5
0
 public function testDoNotAddInstalledRunOnce3()
 {
     RunonceManager::clearRunonces();
     $package = new CompletePackage('test/package', '1.0.0.0', '1.0.0');
     $package->setExtra(array('contao' => array('sources' => array('test' => 'system/modules/test'), 'runonce' => array('system/runonce.php'))));
     $package->setTargetDir('Some/Namespace');
     RunonceManager::addRunonces($package, $this->rootDir);
     $this->assertEquals(array(), RunonceManager::getRunonces(), 'Installed runonce has been added.');
     $this->assertEmpty(RunonceManager::getRunonces(), 'Installed runonce has been added.');
 }