Exemple #1
0
 public function signin_onSubmit()
 {
     $rules = ['login' => 'required|min:2|max:32', 'password' => 'required|min:2'];
     $validation = Validator::make(post(), $rules);
     if ($validation->fails()) {
         throw new ValidationException($validation);
     }
     // Authenticate user
     $user = BackendAuth::authenticate(['login' => post('login'), 'password' => post('password')], true);
     // Load version updates
     VersionManager::instance()->updateAll();
     // Redirect to the intended page after successful sign in
     return Redirect::intended(Backend::url('backend'));
 }
 /**
  * Initialize this singleton.
  */
 protected function init()
 {
     $this->pluginManager = PluginManager::instance();
     $this->versionManager = VersionManager::instance();
     $this->tempDirectory = temp_path();
     $this->baseDirectory = base_path();
     $this->disableCoreUpdates = Config::get('cms.disableCoreUpdates', false);
     $this->bindContainerObjects();
     /*
      * Ensure temp directory exists
      */
     if (!File::isDirectory($this->tempDirectory)) {
         File::makeDirectory($this->tempDirectory, 0777, true);
     }
 }
 /**
  * Initialize this singleton.
  */
 protected function init()
 {
     $this->pluginManager = PluginManager::instance();
     $this->versionManager = VersionManager::instance();
     $this->migrator = App::make('migrator');
     $this->repository = App::make('migration.repository');
     $this->tempDirectory = Config::get('cms.tempDir', sys_get_temp_dir());
     $this->baseDirectory = PATH_BASE;
     /*
      * Ensure temp directory exists
      */
     if (!File::isDirectory($this->tempDirectory)) {
         File::makeDirectory($this->tempDirectory, 0777, true);
     }
 }
 protected function getRenderData()
 {
     $activePluginVector = $this->controller->getBuilderActivePluginVector();
     if (!$activePluginVector) {
         return ['pluginVector' => null, 'items' => [], 'unappliedVersions' => []];
     }
     $versionObj = new PluginVersion();
     $items = $versionObj->getPluginVersionInformation($activePluginVector->pluginCodeObj);
     $searchTerm = Str::lower($this->getSearchTerm());
     if (strlen($searchTerm)) {
         $words = explode(' ', $searchTerm);
         $result = [];
         foreach ($items as $version => $versionInfo) {
             $description = $this->getVersionDescription($versionInfo);
             if ($this->textMatchesSearch($words, $version) || strlen($description) && $this->textMatchesSearch($words, $description)) {
                 $result[$version] = $versionInfo;
             }
         }
         $items = $result;
     }
     $versionManager = VersionManager::instance();
     $unappliedVersions = $versionManager->listNewVersions($activePluginVector->pluginCodeObj->toCode());
     return ['pluginVector' => $activePluginVector, 'items' => $items, 'unappliedVersions' => $unappliedVersions];
 }
 public function rollback()
 {
     if (!$this->isApplied()) {
         return;
     }
     $versionManager = VersionManager::instance();
     $versionManager->removePlugin($this->pluginCodeObj->toCode(), $this->version);
 }
 public function testGetNewFileVersions()
 {
     $manager = VersionManager::instance();
     $result = self::callProtectedMethod($manager, 'getNewFileVersions', ['\\October\\Tester', '1.0.3']);
     $this->assertCount(2, $result);
     $this->assertArrayHasKey('1.0.4', $result);
     $this->assertArrayHasKey('1.0.5', $result);
     /*
      * When at version 0, should return everything
      */
     $manager = VersionManager::instance();
     $result = self::callProtectedMethod($manager, 'getNewFileVersions', ['\\October\\Tester']);
     $this->assertCount(5, $result);
     $this->assertArrayHasKey('1.0.1', $result);
     $this->assertArrayHasKey('1.0.2', $result);
     $this->assertArrayHasKey('1.0.3', $result);
     $this->assertArrayHasKey('1.0.4', $result);
     $this->assertArrayHasKey('1.0.5', $result);
 }