コード例 #1
0
 public function execute($request)
 {
     $this->database = array();
     $this->form = new sfForm();
     // Do *NOT* load defaults from existing database configuration because
     // anyone can access install actions if the database can't be accessed.
     // Never expose the database configuration, even to administrators
     $this->form->setValidator('databaseHost', new sfValidatorString());
     $this->form->setWidget('databaseHost', new sfWidgetFormInput());
     $this->form->setDefault('databaseName', 'qubit');
     $this->form->setValidator('databaseName', new sfValidatorString(array('required' => true)));
     $this->form->setWidget('databaseName', new sfWidgetFormInput());
     $this->form->setValidator('databasePassword', new sfValidatorString());
     $this->form->setWidget('databasePassword', new sfWidgetFormInputPassword());
     $this->form->setValidator('databasePort', new sfValidatorString());
     $this->form->setWidget('databasePort', new sfWidgetFormInput());
     $this->form->setDefault('databaseUsername', 'root');
     $this->form->setValidator('databaseUsername', new sfValidatorString());
     $this->form->setWidget('databaseUsername', new sfWidgetFormInput());
     if ($request->isMethod('post')) {
         $this->form->bind($request->getPostParameters());
         if ($this->form->isValid()) {
             $this->database = sfInstall::configureDatabase($this->form->getValues());
             if (count($this->database) < 1) {
                 $symlinks = sfInstall::addSymlinks();
                 $this->redirect(array('module' => 'sfInstallPlugin', 'action' => 'loadData'));
             }
         }
     }
 }
コード例 #2
0
 public function execute($request)
 {
     $this->htaccess = sfInstall::checkHtaccess();
     $this->settingsYml = sfInstall::checkSettingsYml(count($htaccess) < 1);
     if (0 == count($this->htaccess) && 0 == count($this->settingsYml)) {
         return sfView::NONE;
     }
 }
コード例 #3
0
$error |= count($propelIni = sfInstall::checkPropelIni()) > 0;
if (isset($propelIni['notWritable'])) {
    ?>
  <div class="messages error">
    <p>
      <?php 
    echo link_to('propel.ini not writable', array('module' => 'sfInstallPlugin', 'action' => 'help'), array('anchor' => 'propel.ini_not_writable'));
    ?>
    </p>
  </div>
<?php 
}
?>

<?php 
$error |= count($memoryLimit = sfInstall::checkMemoryLimit()) > 0;
if (count($memoryLimit) > 0) {
    ?>
  <div class="messages error">
    <p>
      <?php 
    echo link_to('Your current PHP memory limit is ' . $memoryLimit . ' MB which is less than the minimum limit of ' . sfInstall::$MINIMUM_MEMORY_LIMIT_MB . ' MB.', array('module' => 'sfInstallPlugin', 'action' => 'help'), array('anchor' => 'PHP_memory_limit'));
    ?>
    </p>
  </div>
<?php 
}
?>

<?php 
if ($error) {
コード例 #4
0
 public static function checkSettingsYml($noScriptName)
 {
     $settingsYml = array();
     $settingsYmlPath = sfConfig::get('sf_app_config_dir') . '/settings.yml';
     // Read settings.yml contents from existing settings.yml, settings.yml.tmpl
     // (for a Subversion checkout), or symfony skeleton settings.yml, whichever
     // is found first
     $settingsYmlPaths = array();
     $settingsYmlPaths[] = $settingsYmlPath;
     $settingsYmlPaths[] = $settingsYmlPath . '.tmpl';
     $settingsYmlPaths[] = sfConfig::get('sf_lib_dir') . '/task/generator/skeleton/app/app/config/settings.yml';
     foreach ($settingsYmlPaths as $path) {
         if (false !== ($settingsYmlContents = file_get_contents($path))) {
             break;
         }
     }
     $settingsYmlContents = sfInstall::setNoScriptName($noScriptName, $settingsYmlContents);
     if (false === file_put_contents($settingsYmlPath, $settingsYmlContents)) {
         $settingsYml['notWritable'] = 'notWritable';
     }
     chdir(sfConfig::get('sf_root_dir'));
     // TODO By instantiating a new application configuration the cache clear
     // task may change these settings, leading to bugs in code which expects
     // them to remain constant
     $saveDebug = sfConfig::get('sf_debug');
     $saveLoggingEnabled = sfConfig::get('sf_logging_enabled');
     // TODO We do not want to cache anything during install, but currently we
     // must clear the cache after adding enabling sfInstallPlugin : (
     $cacheClear = new sfCacheClearTask(sfContext::getInstance()->getEventDispatcher(), new sfFormatter());
     $cacheClear->run();
     sfConfig::set('sf_debug', $saveDebug);
     sfConfig::set('sf_logging_enabled', $saveLoggingEnabled);
     return $settingsYml;
 }
コード例 #5
0
<h2>Loading data</h2>

<?php 
sfInstall::insertSql();
?>

<?php 
sfInstall::loadData();
?>

<!-- If JavaScript is enabled, automatically redirect to the next task.  Include a link in case it is not. -->
<ul>
  <li><?php 
echo link_to('Continue', array('module' => 'sfInstallPlugin', 'action' => 'configureSite'));
?>
</li>
</ul>
<?php 
if (!$error) {
    $sf_context->getController()->redirect(array('module' => 'sfInstallPlugin', 'action' => 'configureSite'));
}