예제 #1
0
파일: ExtShell.php 프로젝트: saydulk/croogo
 /**
  * Deactivate a plugin
  *
  * @param string $plugin
  * @return boolean
  */
 protected function _deactivatePlugin($plugin)
 {
     $usedBy = $this->_CroogoPlugin->usedBy($plugin);
     if ($usedBy === false) {
         $result = $this->_CroogoPlugin->deactivate($plugin);
         if ($result === false) {
             $this->err(__d('croogo', 'Plugin "%s" could not be deactivated. Please, try again.', $plugin));
         } elseif (is_string($result)) {
             $this->err($result);
         }
     } else {
         $result = false;
         if ($usedBy !== false) {
             if ($this->params['force'] === false) {
                 $this->err(__d('croogo', 'Plugin "%s" could not be deactivated since "%s" depends on it.', $plugin, implode(', ', $usedBy)));
             } else {
                 $result = true;
             }
         }
     }
     if ($this->params['force'] === true || $result === true) {
         $this->_CroogoPlugin->removeBootstrap($plugin);
         $result = true;
     }
     if ($result === true) {
         $this->out(__d('croogo', 'Plugin "%s" deactivated successfully.', $plugin));
         return true;
     }
     return false;
 }
예제 #2
0
 /**
  * testUsedBy
  */
 public function testUsedBy()
 {
     Cache::delete('pluginDeps', 'cached_settings');
     CroogoPlugin::load('Widgets');
     CroogoPlugin::load('Editors');
     CroogoPlugin::load('Articles');
     CroogoPlugin::cacheDependencies();
     $usedBy = $this->CroogoPlugin->usedBy('Widgets');
     $this->assertTrue(in_array('Articles', $usedBy));
     $this->assertTrue(in_array('Editors', $usedBy));
     CroogoPlugin::unload('Articles');
     CroogoPlugin::unload('Editors');
     CroogoPlugin::unload('Widgets');
 }