/** 
  * @see	wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
  */
 public function uninstall()
 {
     // call uninstall event
     EventHandler::fireAction($this, 'uninstall');
     // get all style of this package
     $isDefault = false;
     $styleList = new StyleList();
     $styleList->getConditionBuilder()->add("packageID = ?", array($this->installation->getPackageID()));
     $styleList->sqlLimit = 0;
     $styleList->readObjects();
     foreach ($styleList->getObjects() as $style) {
         $styleEditor = new StyleEditor($style);
         $styleEditor->delete();
         $isDefault = $isDefault || $style->isDefault;
     }
     // default style deleted
     if ($isDefault) {
         $styleList = new StyleList();
         $styleList->sqlOrderBy = 'style.styleID ASC';
         $styleList->sqlLimit = 1;
         $styleList->readObjects();
         $styles = $styleList->getObjects();
         if (count($styles)) {
             $styleEditor = new StyleEditor($styles[0]);
             $styleEditor->setAsDefault();
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Returns the style chooser dialog.
  * 
  * @return	array<string>
  */
 public function getStyleChooser()
 {
     $styleList = new StyleList();
     if (!WCF::getSession()->getPermission('admin.style.canUseDisabledStyle')) {
         $styleList->getConditionBuilder()->add("style.isDisabled = ?", array(0));
     }
     $styleList->sqlOrderBy = "style.styleName ASC";
     $styleList->readObjects();
     WCF::getTPL()->assign(array('styleList' => $styleList));
     return array('actionName' => 'getStyleChooser', 'template' => WCF::getTPL()->fetch('styleChooser'));
 }
 /**
  * Updates styles files of all styles.
  */
 protected function cleanup()
 {
     // get all styles
     $styleList = new StyleList();
     $styleList->sqlLimit = 0;
     $styleList->readObjects();
     foreach ($styleList->getObjects() as $style) {
         $styleEditor = new StyleEditor($style);
         $styleEditor->writeStyleFile();
     }
 }