Start
@param $packageVersion
197684
public static function start($packageVersion = '*')
    {
        // Remove
        $removeList = array(
            'manual',
            'script',
            'system',
            'test',
            'test_case',
            '.coveralls.yml',
            '.develop.json',
            '.travis.yml',
            'autoload.php',
            'phpunit.xml'
        );
        foreach ($removeList as $file) {
            self::remove($file);
        }
        // Copy
        copy('application/config/environment.example.yaml', 'application/config/environment.yaml');
        // Composer
        $composerFile = 'composer.json';
        $composerData = file_get_contents($composerFile);
        $composerData = json_decode($composerData, true);
        $packageName = isset($composerData['name']) ? $composerData['name'] : 'codemommy/webphp';
        $packageName = strtolower($packageName);
        $data = array(
            'require' => array(
                $packageName => $packageVersion
            )
        );
        $composerJSON = json_encode($data, JSON_PRETTY_PRINT);
        $composerJSON = str_replace('\\', '', $composerJSON);
        file_put_contents($composerFile, $composerJSON);
        system('composer update', $returnCode);
        if (intval($returnCode) == 0) {
            $installedVersion = $packageVersion;
            $composerLockFile = 'composer.lock';
            $composerLockContent = file_get_contents($composerLockFile);
            $composerLockArray = json_decode($composerLockContent, true);
            $packages = isset($composerLockArray['packages']) ? $composerLockArray['packages'] : array();
            foreach ($packages as $package) {
                if (strtolower($package['name']) == $packageName) {
                    $installedVersion = $package['version'];
                    break;
                }
            }
            echo(sprintf('CodeMommy WebPHP %s has been installed successfully', $installedVersion));
        }
    }
883192
public function publishPackage($package, $packagePath = null)
    {
        $source = $this->getSource($package, $packagePath ?: $this->packagePath);

        return $this->publish($package, $source);
    }
379587
public function activate($versionNumber, $oldVersionNumber = '')
    {
        // Add the assets
        $assetManager = $this->framework->getInstance('\\Zepi\\Web\\General\\Manager\\AssetManager');
        $assetManager->addAsset(AssetManager::CSS, 'bootstrap', 'vendor/twitter/bootstrap/dist/css/bootstrap.css');
        $assetManager->addAsset(AssetManager::CSS, 'bootstrap-theme', 'vendor/twitter/bootstrap/dist/css/bootstrap-theme.css', array('bootstrap'));
        $assetManager->addAsset(AssetManager::CSS, 'materialdesignicons', 'vendor/mervick/material-design-icons/css/material-icons.css');
        $assetManager->addAsset(AssetManager::CSS, 'zt-base', $this->directory . '/assets/css/base.css', array('bootstrap-theme'));
        $assetManager->addAsset(AssetManager::CSS, 'zt-theme', $this->directory . '/assets/css/theme.css', array('zt-base'));
        $assetManager->addAsset(AssetManager::CSS, 'zt-elements', $this->directory . '/assets/css/elements.css', array('zt-base'));
        $assetManager->addAsset(AssetManager::CSS, 'zt-form', $this->directory . '/assets/css/form.css', array('zt-base'));
        $assetManager->addAsset(AssetManager::CSS, 'zt-print', $this->directory . '/assets/css/print.css', array('zt-base'));
        
        $assetManager->addAsset(AssetManager::JS, 'modernizr', 'vendor/components/modernizr/modernizr.js');
        $assetManager->addAsset(AssetManager::JS, 'jquery', 'vendor/components/jquery/jquery.min.js');
        $assetManager->addAsset(AssetManager::JS, 'bootstrap', 'vendor/twitter/bootstrap/dist/js/bootstrap.min.js', array('jquery'));
        $assetManager->addAsset(AssetManager::JS, 'zt-main', $this->directory . '/assets/js/main.js', array('jquery'));
        
        $assetManager->addAsset(AssetManager::IMAGE, 'logo', $this->directory . '/assets/images/logo.svg');
        $assetManager->addAsset(AssetManager::IMAGE, 'logo-mail', $this->directory . '/assets/images/logo-mail.jpg');
        
        // Add the templates
        $templatesManager = $this->framework->getInstance('\\Zepi\\Web\\General\\Manager\\TemplatesManager');
        $templatesManager->addTemplate('\\Zepi\\Web\\ThemeZt\\Templates\\Header', $this->directory . '/templates/overall/Header.phtml');
        $templatesManager->addTemplate('\\Zepi\\Web\\ThemeZt\\Templates\\Footer', $this->directory . '/templates/overall/Footer.phtml');
        $templatesManager->addTemplate('\\Zepi\\Web\\ThemeZt\\Templates\\NavItemRoot', $this->directory . '/templates/snippets/NavItemRoot.phtml');
        $templatesManager->addTemplate('\\Zepi\\Web\\ThemeZt\\Templates\\NavItemSubmenu', $this->directory . '/templates/snippets/NavItemSubmenu.phtml');
        $templatesManager->addTemplate('\\Zepi\\Web\\ThemeZt\\Templates\\Mail\\Header', $this->directory . '/templates/mail/Header.phtml');
        $templatesManager->addTemplate('\\Zepi\\Web\\ThemeZt\\Templates\\Mail\\Footer', $this->directory . '/templates/mail/Footer.phtml');
        
        // Add the settings
        $configurationManager = $this->framework->getInstance('\\Zepi\\Core\\Utils\\Manager\\ConfigurationManager');
        $configurationManager->addSettingIfNotSet('web.defaultPage', '/');
        $configurationManager->saveConfigurationFile();
    }
568962
function start(mode, target, system, containerDef, container, out, cb) {
    if (mode !== 'preview') {
      main.setup(config, mode, target, system, containerDef, container, out, cb);
    } else {
      cb();
    }
  }
971430
public function activate($versionNumber, $oldVersionNumber = '')
    {
        $runtimeManager = $this->framework->getRuntimeManager();
        $runtimeManager->addFilterHandler('\\Zepi\\Core\\AccessControl\\Filter\\AccessLevelManager\\RemoveAccessLevel', '\\Zepi\\Core\\AccessControl\\FilterHandler\\RevokePermissionsForRemovedAccessLevel');
        $runtimeManager->addFilterHandler('\\Zepi\\Turbo\\Filter\\VerifyEventName', '\\Zepi\\Core\\AccessControl\\FilterHandler\\CheckEventAccessForSession');
        
        $runtimeManager->addEventHandler('\\Zepi\\Core\\AccessControl\\Event\\RedirectRequestWithoutSession', '\\Zepi\\Core\\AccessControl\\EventHandler\\RedirectRequestWithoutSession');
        $runtimeManager->addEventHandler('\\Zepi\\Core\\AccessControl\\Event\\DisplayNoAccessMessage', '\\Zepi\\Core\\AccessControl\\EventHandler\\DisplayNoAccessMessage');
        
        // Data Sources
        $dataSourceManager = $this->framework->getDataSourceManager();
        $dataSourceManager->addDataSource(
            '\\Zepi\\Core\\AccessControl\\DataSource\\AccessEntitiesDataSourceInterface',
            '\\Zepi\\DataSource\\Doctrine',
            '\\Zepi\\Core\\AccessControl\\DataSource\\AccessEntitiesDataSourceDoctrine'
        );
        
        $dataSourceManager->addDataSource(
            '\\Zepi\\Core\\AccessControl\\DataSource\\PermissionsDataSourceInterface',
            '\\Zepi\\DataSource\\Doctrine',
            '\\Zepi\\Core\\AccessControl\\DataSource\\PermissionsDataSourceDoctrine'
        );
        
        // Access Levels
        $accessLevelsManager = $this->framework->getInstance('\\Zepi\\Core\\AccessControl\\Manager\\AccessLevelManager');
        $accessLevelsManager->addAccessLevel(new \Zepi\Core\AccessControl\Entity\AccessLevel(
            '\\Global\\*',
            'Global Super User',
            'Super user privileges. Can do everything.',
            '\\Zepi\\Core\\AccessControl'
        ));
        
        $accessLevelsManager->addAccessLevel(new \Zepi\Core\AccessControl\Entity\AccessLevel(
            '\\Global\\Disabled',
            'Disabled User',
            'A disabled user. Can do nothing, not even login.',
            '\\Zepi\\Core\\AccessControl'
        ));
        
        $accessLevelsManager->addAccessLevel(new \Zepi\Core\AccessControl\Entity\AccessLevel(
            '\\Global\\Active',
            'Active User',
            'A active user. Can login and change the user password.',
            '\\Zepi\\Core\\AccessControl'
        ));
    }
318003
public function startAddons($addons) {

        // Scan source folders
        $this->scanSourceFolders();

        $this->log(LogLevel::NOTICE, "Starting addons");

        // Include and instantiate active addons
        $this->enabled = [];

        foreach ($addons as $addonName => $requiredAddonState) {

            // Ignore 'off' addons
            if ($requiredAddonState != 'on') {
                continue;
            }

            $this->startAddon($addonName);
        }
    }
43864
public function activate($versionNumber, $oldVersionNumber = '')
    {
        // Configuration
        $configurationManager = $this->framework->getInstance('\\Zepi\\Core\\Utils\\Manager\\ConfigurationManager');
        $configurationManager->addSettingIfNotSet('mailer.type', 'sendmail');
        $configurationManager->addSettingIfNotSet('mailer.sendmailCommand', '/usr/sbin/sendmail -bs');
        $configurationManager->addSettingIfNotSet('mailer.smtpHost', '');
        $configurationManager->addSettingIfNotSet('mailer.smtpPort', 25);
        $configurationManager->addSettingIfNotSet('mailer.smtpUsername', '');
        $configurationManager->addSettingIfNotSet('mailer.smtpPassword', '');
        $configurationManager->addSettingIfNotSet('mailer.sendFrom', 'info@turbo.local');
        $configurationManager->addSettingIfNotSet('mailer.sendFromName', 'zepi Turbo');
        $configurationManager->saveConfigurationFile();
    }
595456
public function run($data)
    {
        $processId = $data['id'];

        $GLOBALS['log']->debug('Installation process ['.$processId.']: start run.');

        if (empty($processId)) {
            throw new Error('Installation package ID was not specified.');
        }

        $this->setProcessId($processId);

        $this->initialize();

        /** check if an archive is unzipped, if no then unzip */
        $packagePath = $this->getPackagePath();
        if (!file_exists($packagePath)) {
            $this->unzipArchive();
            $this->isAcceptable();
        }

        //check permissions copied and deleted files
        $this->checkIsWritable();

        $this->enableMaintenanceMode();

        $this->beforeRunAction();

        $this->backupExistingFiles();

        //beforeInstallFiles
        if (!$this->copyFiles('before')) {
            $this->throwErrorAndRemovePackage('Cannot copy beforeInstall files.');
        }

        /* run before install script */
        if (!isset($data['skipBeforeScript']) || !$data['skipBeforeScript']) {
            $this->runScript('before');
        }

        /* remove files defined in a manifest "deleteBeforeCopy" */
        $this->deleteFiles('deleteBeforeCopy', true);

        /* copy files from directory "Files" to EspoCRM files */
        if (!$this->copyFiles()) {
            $this->throwErrorAndRemovePackage('Cannot copy files.');
        }

        /* remove files defined in a manifest */
        $this->deleteFiles('delete', true);

        $this->deleteFiles('vendor');
        $this->copyFiles('vendor');

        $this->disableMaintenanceMode();

        if (!isset($data['skipSystemRebuild']) || !$data['skipSystemRebuild']) {
            if (!$this->systemRebuild()) {
                $this->throwErrorAndRemovePackage('Error occurred while EspoCRM rebuild.');
            }
        }

        //afterInstallFiles
        if (!$this->copyFiles('after')) {
            $this->throwErrorAndRemovePackage('Cannot copy afterInstall files.');
        }

        /* run after install script */
        if (!isset($data['skipAfterScript']) || !$data['skipAfterScript']) {
            $this->runScript('after');
        }

        $this->afterRunAction();

        $this->finalize();

        /* delete unziped files */
        $this->deletePackageFiles();

        if ($this->getManifestParam('skipBackup')) {
            $this->getFileManager()->removeInDir([$this->getPath('backupPath'), self::FILES]);
        }

        $GLOBALS['log']->debug('Installation process ['.$processId.']: end run.');

        $this->clearCache();
    }
99303
@Validate
    public void start() {
        if (directory.isDirectory()) {
            buildFileIndex();
        }
        if (tracker != null) {
            tracker.open();
        }
        if (deployer != null) {
            deployer.start();
        }
    }
1008802
public function start() {

        if($this->findElement()) {
            // Find all the objects!
            while(!$this->arrayEnd) {
                if(!$this->eatWhitespace()) break;
                if($this->readObject()){
                    yield $this->packageJSON();
                    $this->sanitize();
                }
            }
        }

    }
585292
public static function Start() {
      
      self::$Prefixes = array(
         self::CONTEXT_CORE            => 'c',
         self::CONTEXT_APPLICATION     => 'a',
         self::CONTEXT_PLUGIN          => 'p',
         self::CONTEXT_THEME           => 't'
      );
      self::$ContextOrder = array(
         self::CONTEXT_THEME,
         self::CONTEXT_LOCALE,
         self::CONTEXT_PLUGIN,
         self::CONTEXT_APPLICATION,
         self::CONTEXT_CORE
      );
      
      self::$Maps = array();
      self::$MapGroups = array();
   
      // Register autoloader with the SPL
      spl_autoload_register(array('Gdn_Autoloader', 'Lookup'));
      
      // Configure library/core and library/database
      self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_CORE, PATH_LIBRARY.'/core');
      self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_CORE, PATH_LIBRARY.'/database');
      self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_CORE, PATH_LIBRARY.'/vendors');
      
      // Register shutdown function to auto save changed cache files
      register_shutdown_function(array('Gdn_Autoloader', 'Shutdown'));
   }
138866
public void start(BundleContext context) throws Exception {
    	Util.getLogger().info("Starting Jdbc bundle");
        
        //xthis.setProperty(BundleActivatorModel.PACKAGE_NAME, Util.getPackageName(JdbcDatabase.class.getName()));
        //x this.setProperty(BundleService.INTERFACE, BaseDatabase.class.getName());
        this.setProperty(BundleConstants.TYPE, DBParams.JDBC);
        
        super.start(context);
    }
52512
public function importPackageVersionTranslatables($packageHandle, $packageVersion, $formatHandle)
    {
        $this->start();
        try {
            $this->getUserControl()->checkRateLimit();
            $this->getUserControl()->checkGenericAccess(__FUNCTION__);
            $em = $this->app->make(EntityManager::class);
            $post = $this->request->request;
            $packageName = $post->get('packageName', '');
            if (!is_string($packageName)) {
                $packageName = '';
            }
            $packageVersion = is_string($packageVersion) ? trim($packageVersion) : '';
            if ($packageVersion === '') {
                throw new UserMessageException(t('Package version not specified'), Response::HTTP_NOT_ACCEPTABLE);
            }
            $format = $this->app->make(TranslationsConverterProvider::class)->getByHandle($formatHandle);
            if ($format === null) {
                throw new UserMessageException(t('Unable to find the specified translations format'), 404);
            }
            $package = $this->app->make(PackageRepository::class)->findOneBy(['handle' => $packageHandle]);
            if ($package === null) {
                $package = PackageEntity::create($packageHandle, $packageName);
                $em->persist($package);
                $em->flush($package);
                $version = null;
            } else {
                if ($packageName !== '' && $package->getName() !== $packageName) {
                    $package->setName($packageName);
                    $em->persist($package);
                    $em->flush($package);
                }
                $version = $this->app->make(PackageVersionRepository::class)->findByOneBy(['package' => $package, 'version' => $packageVersion]);
            }
            if ($version === null) {
                $version = PackageVersionEntity::create($package, $packageVersion);
                $em->persist($version);
                $em->flush($version);
            }
            $file = $this->request->files->get('file');
            if ($file === null) {
                throw new UserMessageException(t('The file with translatable strings has not been specified'), Response::HTTP_NOT_ACCEPTABLE);
            }
            if (!$file->isValid()) {
                throw new UserMessageException(t('The file with translatable strings has not been received correctly: %s', $file->getErrorMessage()), Response::HTTP_NOT_ACCEPTABLE);
            }
            $translations = $format->loadTranslationsFromFile($file->getPathname());
            if (count($translations) < 1) {
                throw new UserMessageException(t('No translatable strings found in uploaded file'));
            }
            $importer = $this->app->make(TranslatableImporter::class);
            $changed = $importer->importTranslations($translations, $package->getHandle(), $packageVersion->getVersion());
            $result = $this->buildJsonResponse(['changed' => $changed]);
        } catch (Exception $x) {
            $result = $this->buildErrorResponse($x);
        } catch (Throwable $x) {
            $result = $this->buildErrorResponse($x);
        }

        return $this->finish($result);
    }
1058249
private void startSetupIabAsync(final String packageName, final OnIabSetupFinishedListener listener) {
        new Thread(new Runnable() {
            @Override public void run() {
                try {
                    Logger.d("Checking for in-app billing 3 support.");

                    // check for in-app billing v3 support
                    int response = mService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP);
                    if (response != BILLING_RESPONSE_RESULT_OK) {
                        if (listener != null) listener.onIabSetupFinished(new IabResult(response,
                                "Error checking for billing v3 support."));

                        // if in-app purchases aren't supported, neither are subscriptions.
                        mSubscriptionsSupported = false;
                        return;
                    }
                    Logger.d("In-app billing version 3 supported for ", packageName);

                    // check for v3 subscriptions support
                    response = mService.isBillingSupported(3, packageName, ITEM_TYPE_SUBS);
                    if (response == BILLING_RESPONSE_RESULT_OK) {
                        Logger.d("Subscriptions AVAILABLE.");
                        mSubscriptionsSupported = true;
                    } else {
                        Logger.d("Subscriptions NOT AVAILABLE. Response: ", response);
                    }

                    mSetupDone = true;
                } catch (RemoteException e) {
                    if (listener != null) {
                        listener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION,
                                "RemoteException while setting up in-app billing."));
                    }
                    Logger.e("RemoteException while setting up in-app billing", e);
                    return;
                }

                if (listener != null) {
                    listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful."));
                    Logger.d("Setup successful.");
                }
            }
        }).start();
    }
1050118
@Override
	public void start(BundleContext context) throws Exception {
		super.start(context);
		ResourcesPlugin.getWorkspace().addResourceChangeListener(ResourceManager.getInstance());
		plugin = this;
	}
640290
public function setVersion($version)
    {
        if (Version::isKnown($version) === true) {
            $this->version = Version::appendPatchVersion($version);
        } else {
            $msg = "Version '{$version}' is not a known QTI version. Known versions are '" . implode(', ', Version::knownVersions()) . "'";
            throw new InvalidArgumentException($msg);
        }
    }
1093447
static function Start($level = null)
	{
		
		if ($level == null) 
		{
			if (defined("E_DEPRECATED"))
			{
				$level = E_ALL & ~E_DEPRECATED ;
			}
			else
			{
				// php 5.2 and earlier don't support E_DEPRECATED
				$level = E_ALL;
				self::$IGNORE_DEPRECATED = true;
			}
		}
		set_error_handler(array("ExceptionThrower", "HandleError"), $level);
	}