Puts the CampaignChain app into same status as after a fresh
<code>
composer create-project
</code>
installation.
973770
public static function resetApp()
    {
        // Set install mode.
        SystemUtil::enableInstallMode();

        $currentDir = getcwd();
        chdir(self::getRootDir());
        ob_start();
        // Drop all tables
        $command = 'php bin/console doctrine:schema:drop --force --full-database';
        system($command, $output);
        // Run composer post install command.
        $command = 'composer run-script post-install-cmd';
        system($command, $output);
        ob_get_clean();
        chdir($currentDir);
    }
1145753
def app_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/apps.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
381087
@SuppressWarnings({"unused", "WeakerAccess"})
    public synchronized void pushInstallReferrer(String source, String medium, String campaign) {
        if (source == null && medium == null && campaign == null) return;
        try {
            // If already pushed, don't send it again
            int status = StorageHelper.getInt(context, "app_install_status", 0);
            if (status != 0) {
                Logger.d("Install referrer has already been set. Will not override it");
                return;
            }
            StorageHelper.putInt(context, "app_install_status", 1);

            if (source != null) source = Uri.encode(source);
            if (medium != null) medium = Uri.encode(medium);
            if (campaign != null) campaign = Uri.encode(campaign);

            String uriStr = "wzrk://track?install=true";
            if (source != null) uriStr += "&utm_source=" + source;
            if (medium != null) uriStr += "&utm_medium=" + medium;
            if (campaign != null) uriStr += "&utm_campaign=" + campaign;

            Uri uri = Uri.parse(uriStr);
            pushDeepLink(uri, true);
        } catch (Throwable t) {
            Logger.v("Failed to push install referrer", t);
        }
    }
812441
function _addPlatformsToProject(cordovaPlatforms, projectPath, cordova) {
    var promise = Q();
    cordovaPlatforms.forEach(function (platform) {
        if (!utilities.fileExistsSync(path.join(projectPath, 'platforms', platform))) {
            promise = promise.then(function () { return cordova.raw.platform('add', platform); });
        } else {
            console.log('Platform ' + platform + ' already added.');
        }
    });

    return promise;
}
1240726
final void install() {
        Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        Uri uri = AndPermission.getFileUri(mSource.getContext(), mFile);
        intent.setDataAndType(uri, "application/vnd.android.package-archive");
        mSource.startActivity(intent);
    }
443190
@Restricted(NoExternalUse.class)
    public synchronized void persistInstallStatus() {
        List<UpdateCenterJob> jobs = getJobs();

        boolean activeInstalls = false;
        for (UpdateCenterJob job : jobs) {
            if (job instanceof InstallationJob) {
                InstallationJob installationJob = (InstallationJob) job;
                if(!installationJob.status.isSuccess()) {
            activeInstalls = true;
                }
            }
        }

        if(activeInstalls) {
        InstallUtil.persistInstallStatus(jobs); // save this info
        }
        else {
        InstallUtil.clearInstallStatus(); // clear this info
        }
    }
196035
def save(self):
        
        self.projects.save()
        self.experiments.save()
        safe_dump(self.global_config, self._globals_file,
                  default_flow_style=False)
20247
private void addNewApplications(List<XLDeployApplication> applications,
                                    XLDeployCollector collector) {
        long start = System.currentTimeMillis();
        int count = 0;

        log("All apps", start, applications.size());
        for (XLDeployApplication application : applications) {
        	XLDeployApplication existing = findExistingApplication(collector, application);

        	String niceName = getNiceName(application, collector);
            if (existing == null) {
                application.setCollectorId(collector.getId());
                application.setEnabled(false);
                application.setDescription(application.getApplicationName());
                if (StringUtils.isNotEmpty(niceName)) {
                	application.setNiceName(niceName);
                }
                try {
                    xlDeployApplicationRepository.save(application);
                } catch (org.springframework.dao.DuplicateKeyException ce) {
                    log("Duplicates items not allowed", 0);

                }
                count++;
            } else if (StringUtils.isEmpty(existing.getNiceName()) && StringUtils.isNotEmpty(niceName)) {
				existing.setNiceName(niceName);
                xlDeployApplicationRepository.save(existing);
            }
        }
        
        log("New apps", start, count);
    }
58416
def add_project_ui(self):
        

        directory = umbra.ui.common.store_last_browsed_path(QFileDialog.getExistingDirectory(self,
                                                                                             "Add Project:",
                                                                                             RuntimeGlobals.last_browsed_path))
        if not directory:
            return False

        return self.add_project(directory)
492789
private function registerDistribution()
    {
        /*
         * If a system entry already exists (e.g. from sample
         * data), then update it.
         */
        $system = $this->systemService->getActiveSystem();

        if (!$system) {
            $system = new System();
        }

        $config = $this->rootDir.'composer.json';
        $configContent = file_get_contents($config);
        $this->appComposerJson = json_decode($configContent, true);

        $system->setPackage($this->appComposerJson['name']);
        $system->setName($this->appComposerJson['description']);
        $system->setVersion($this->appComposerJson['version']);
        $system->setHomepage($this->appComposerJson['homepage']);
        $system->setModules($this->appComposerJson['extra']['campaignchain']['distribution']['modules']);

        if (
            isset($this->appComposerJson['extra']['campaignchain']['distribution']['terms-url']) &&
            !empty($this->appComposerJson['extra']['campaignchain']['distribution']['terms-url'])
        ) {
            $system->setTermsUrl($this->appComposerJson['extra']['campaignchain']['distribution']['terms-url']);
        }

        $this->em->persist($system);
        $this->em->flush();
    }
298752
public function install(): OperationResult
    {
        $result = new OperationResult();

        $sourcePath = "{$this->packageInstallDir}/.installer/%s/bundles.php";
        foreach ($this->projectType->getProjectDirs() as $projectDir) {
            $bundleFile = sprintf($sourcePath, $projectDir);
            if (is_file($bundleFile)) {
                $data = require $bundleFile;
                if (!is_array($data)) {
                    $result->addErrorMessage('<error>The bundles.php file in installer must return an array</error>');
                    break;
                }

                $installedBundlesFile = "{$this->projectRootDir}/config/bundles.php";
                if (file_exists($installedBundlesFile)) {
                    $installedBundles = require $installedBundlesFile;
                    if (is_array($installedBundles)) {
                        $resultingBundleData = array_merge($installedBundles, $data);

                        $export = $this->dumpConfig($resultingBundleData);
                        if (!file_put_contents($installedBundlesFile, $export, LOCK_EX)) {
                            $result->addErrorMessage("<error>Could not copy bundle content from {$this->packageName}</error>");
                        }
                    }
                }
            }
        }

        if (!$result->isFailure()) {
            $result->addStatusMessage("Successfully copied Bundle information from {$this->packageName}");
        }

        return $result;
    }
682873
def reload(self):
        """"""

        app_profile_pb = self.instance_admin_client.get_app_profile(self.name)

        # NOTE: _update_from_pb does not check that the project and
        #       app_profile ID on the response match the request.
        self._update_from_pb(app_profile_pb)
1147444
public function projectSetupNew()
    {
        $this->executeCommandHook(__FUNCTION__, 'before');
        $this->projectInstance()->setupNewProject();
        $this->executeCommandHook(__FUNCTION__, 'after');
    }
349921
public function onPostCreateProject()
    {
        // Initialise:
        
        $data = [];
        
        // Output Header:
        
        $this->header($this->getConfig('text-header'));
        
        // Obtain App Name:
        
        $data['app-name'] = $this->ask(
            'App name',
            $this->getConfig('default-name'),
            $data
        );
        
        // Obtain Locale:
        
        $data['locale'] = $this->ask(
            'Default locale',
            $this->getConfig('default-locale'),
            $data
        );
        
        // Obtain Database Name:
        
        $data['database'] = $this->ask(
            'Database name',
            $this->getConfig('default-database'),
            $data
        );
        
        // Obtain Vendor:
        
        $data['vendor'] = $this->ask(
            'Vendor',
            $this->getConfig('default-vendor'),
            $data
        );
        
        // Obtain Author Name:
        
        $data['author-name'] = $this->ask(
            'Author name',
            $this->getConfig('default-author-name'),
            $data
        );
        
        // Obtain Author Email:
        
        $data['author-email'] = $this->ask(
            'Author email',
            $this->getConfig('default-author-email'),
            $data
        );
        
        // Obtain Author Company:
        
        $data['author-company'] = $this->ask(
            'Author company',
            $this->getConfig('default-author-company'),
            $data
        );
        
        // Obtain Author Homepage:
        
        $data['author-homepage'] = $this->ask(
            'Author homepage',
            $this->getConfig('default-author-homepage'),
            $data
        );
        
        // Obtain Repository Name:
        
        $data['repo-name'] = $this->ask(
            'Repository name',
            $this->getConfig('default-repo-name'),
            $data
        );
        
        // Obtain Repository URL:
        
        $data['repo-url'] = $this->ask(
            'Repository URL',
            $this->getConfig('default-repo-url'),
            $data
        );
        
        // Obtain Project Link:
        
        $data['project-link'] = $this->ask(
            'Project link',
            $this->getConfig('default-project-link'),
            $data
        );
        
        // Obtain License Name:
        
        $data['license-name'] = $this->ask(
            'License name',
            $this->getConfig('default-license-name'),
            $data
        );
        
        // Obtain License Link:
        
        $data['license-link'] = $this->ask(
            'License link',
            $this->getConfig('default-license-link'),
            $data
        );
        
        // Obtain Repository Branches:
        
        $data['branch-staging'] = $this->ask(
            'Repository branch:staging',
            $this->getConfig('default-branch-staging'),
            $data
        );
        
        $data['branch-production'] = $this->ask(
            'Repository branch:production',
            $this->getConfig('default-branch-production'),
            $data
        );
        
        // Obtain User Names:
        
        $data['user-staging'] = $this->ask(
            'User name:staging',
            $this->getConfig('default-user'),
            $data
        );
        
        $data['user-production'] = $this->ask(
            'User name:production',
            $this->getConfig('default-user'),
            $data
        );
        
        // Obtain Host Names:
        
        $data['host-staging'] = $this->ask(
            'Host name:staging',
            $this->getConfig('default-host-staging'),
            $data
        );
        
        $data['host-production'] = $this->ask(
            'Host name:production',
            $this->getConfig('default-host-production'),
            $data
        );
        
        // Obtain Deployment Paths:
        
        $data['path-staging'] = $this->ask(
            'Deployment path:staging',
            $this->getConfig('default-path-staging'),
            $data
        );
        
        $data['path-production'] = $this->ask(
            'Deployment path:production',
            $this->getConfig('default-path-production'),
            $data
        );
        
        // Obtain App Namespace:
        
        $data['app-namespace'] = $this->ask(
            'App namespace',
            $this->getConfig('default-app-namespace'),
            $data
        );
        
        // Obtain App Title and Tagline:
        
        $data['app-title'] = $this->ask(
            'App title',
            $this->getConfig('default-app-title'),
            $data
        );
        
        $data['app-tagline'] = $this->ask(
            'App tagline',
            $this->getConfig('default-app-tagline'),
            $data
        );
        
        // Define Year:
        
        $data['year'] = date('Y');
        
        // Write Namespace and Data:
        
        $result = false;
        
        if ($this->writeNamespace($data['app-namespace'], $this->getConfig('namespace-files'))) {
            $result = $this->writeData($data, $this->getConfig('files'));
        }
        
        // Handle Installation Result:
        
        if ($result) {
            
            // Report Success:
            
            $this->io()->write(
                $this->color(
                    $this->getConfig('text-install-success'),
                    $this->getConfig('fg-success')
                )
            );
            
        } else {
            
            // Report Failure:
            
            $this->io()->write(
                $this->color(
                    $this->getConfig('text-install-failure'),
                    $this->getConfig('fg-failure')
                )
            );
            
        }
    }
1352848
public function doPerform()
    {
        if (!$this->mayInstall()) {
            throw new \RuntimeException('Project directory not empty.');
        }

        // Will throw exception upon error.
        $this->prepareTmpDir();

        $this->preserveEnvironment();

        try {
            parent::doPerform();
            $this->moveFiles();
        } catch (\Exception $exception) {
            $this->restoreEnvironment();
            throw new \RuntimeException('Project could not be created.', 1, $exception);
        } finally {
            $this->restoreEnvironment();
        }

        rmdir($this->tempDir);
    }
1318199
def make_setup_state(
            self,
            app: 'Quart',
            first_registration: bool,
            *,
            url_prefix: Optional[str]=None,
    ) -> 'BlueprintSetupState':
        
        return BlueprintSetupState(self, app, first_registration, url_prefix=url_prefix)
605611
protected function after_execute() {
        $this->add_related_files('mod_assign', 'intro', null);
        $this->add_related_files('mod_assign', 'introattachment', null);

        $this->add_plugin_config_files('assignsubmission');
        $this->add_plugin_config_files('assignfeedback');

        $this->set_latest_submission_field();
    }