Пример #1
0
 public function ckeckPostInstaller()
 {
     // check installer
     $installer_path = $this->getPackageDirectory() . $this->getSetupFilepath();
     $install_name = $this->getPackage() . '_' . self::SETUP_SCRIPT . '_postinstall';
     $text = '';
     //
     if (!file_exists($installer_path)) {
         //create installer
         $text = PEAR_PackageProjector_ConfigureManeger::getPostInstallerText($install_name, $this->Installgroups);
         file_put_contents($installer_path, $text);
         $handler = PEAR_PackageProjector::singleton()->getMessageHandler();
         $handler->buildMessage(5, "", true);
         $handler->buildMessage(5, "*** Create Installer File ***", true);
         $handler->buildMessage(5, "Create File " . $installer_path, true);
     } else {
         $text = file_get_contents($installer_path);
     }
     //
     if (preg_match("/\n *class +" . preg_quote($install_name) . "[\\s\\{]/", $text)) {
         return true;
     } else {
         throw new PEAR_Exception("The name of Installer class should be \"{$install_name}\" in {$installer_path}.");
         return false;
     }
 }