Пример #1
0
    /**
     * Create the config file with the database settings and write email settings
     *
     * @param sfWebRequest $request
     * @return <type>
     */
    public function executeSaveData(sfWebRequest $request) {
        $sysObj = new SystemSetting();
        $installer = new Installer();
        $data = $request->getPostParameters();
        $installer->createConfigFile($data); // write settings in database.yml
        // create DB
        $task = new sfDoctrineBuildAllReLoadTask(sfContext::getInstance()->getEventDispatcher(), new sfFormatter());
        chdir(sfConfig::get('sf_root_dir'));
        $task->run(array(),array('--no-confirmation', '--env=all', '--dir='.sfConfig::get('sf_root_dir').'/data/fixtures/'.$data['productive_data'].''));
        $data = $sysObj->buildEmailSetting($data);
        UserLoginTable::instance()->updateEmail($data['productive_emailadresse']);
        EmailConfigurationTable::instance()->updateEmailConfiguration($data);
        // clear cache
        $taskCC = new sfCacheClearTask(sfContext::getInstance()->getEventDispatcher(), new sfFormatter());
        $taskCC->run(array(), array());
        // create JS Cache
        $ccCache = new TemplateCaching();
        $ccCache->checkCacheDir();
        $ccCache->setFiles();
        $lastModified = $ccCache->getLastModifiedFile();
        $cacheCreated = $ccCache->getCurrentCacheStamp();

        if($lastModified > $cacheCreated OR $cacheCreated == '') {
            if($cacheCreated == '') {
                $cacheCreated = $lastModified;
            }
            $ccCache->createCache($lastModified, $cacheCreated);
        }
        // return success, then JS redirect
        $this->renderText('{success:true}');
        return sfView::NONE;
    }
Пример #2
0
<?php
    // loading mask -.-
    echo '<div id="loading"><div id="loading-message" style="border:solid;"><table><tr><td><img src="/images/icons/loading.gif" /></td><td>' . __('Loading CuteFlow. Please wait...','','layout') . '</td></tr></table></div></div>';
    $filepath = sfConfig::get('sf_app_dir') . '/config/template.yml';
    $cacheEnabled = sfYAML::Load($filepath);
    if($cacheEnabled['enableJavaScriptCache']['isEnabled'] == 1) { // caching is enabled
        $ccCache = new TemplateCaching();
        $ccCache->checkCacheDir();
        $ccCache->setFiles();
        $lastModified = $ccCache->getLastModifiedFile();
        $cacheCreated = $ccCache->getCurrentCacheStamp();

        if($lastModified > $cacheCreated OR $cacheCreated == '') {
            if($cacheCreated == '') {
                $cacheCreated = $lastModified;
            }
            $ccCache->createCache($lastModified, $cacheCreated);
        }
        $dir = array_diff(scandir(sfConfig::get('sf_cache_dir') . '/javaScriptCache'), Array());
        
        echo ' <script type="text/javascript" src="/djs/cache/'.substr($dir[count($dir)-1],0,-11).'.js"></script>' . "\n";
    }
    else { // caching is off
        echo '<script type="text/javascript" src="/djs/namespace/main.js"></script>';
        $files = new JavaScriptLoader();
        $jsFiles = $files->getAllFiles();
        foreach($jsFiles['djs'] as $singeFile) {
            echo '<script type="text/javascript" src="'.substr($singeFile,0,-11).'.js"></script>' . "\n";
        }
    }