Changeset 2863 for trunk


Ignore:
Timestamp:
Nov 12, 2008, 1:40:20 PM (16 years ago)
Author:
patdenice
Message:
  • Remove advises of file removal at the end of install/upgrade.
  • Automatic change mysql.inc.php if file is writable, else purpose manual change to user.
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/template/goto/upgrade.tpl

    r2836 r2863  
    2323table { margin: 0px; }
    2424td {  padding: 3px 10px; }
     25textarea { margin-left: 20px; }
    2526</style>
    2627{/literal}
  • trunk/install/db/65-database.php

    r2836 r2863  
    103103
    104104// +-----------------------------------------------------------------------+
    105 // load the config file
    106   $config_file = PHPWG_ROOT_PATH.'include/mysql.inc.php';
    107   $config_file_contents = @file_get_contents($config_file);
    108   if ($config_file_contents === false)
    109   {
    110     die('CANNOT LOAD '.$config_file);
    111   }
    112   $php_end_tag = strrpos($config_file_contents, '?'.'>');
    113   if ($php_end_tag === false)
    114   {
    115     die('CANNOT FIND PHP END TAG IN '.$config_file);
    116   }
    117   if (!is_writable($config_file))
    118   {
    119     die('FILE NOT WRITABLE '.$config_file);
    120   }
    121 
    122 
    123 // +-----------------------------------------------------------------------+
    124105// load all the user languages
    125106  $all_langs=array();
     
    275256
    276257// +-----------------------------------------------------------------------+
    277 // write the result to file and update #user_infos.language
    278   $config_file_contents =
    279     substr($config_file_contents, 0, $php_end_tag).'
    280 define(\'PWG_CHARSET\', \''.$pwg_charset.'\');
     258// changes to write in mysql.inc.php
     259  array_push($mysql_changes,
     260'define(\'PWG_CHARSET\', \''.$pwg_charset.'\');
    281261define(\'DB_CHARSET\',  \''.$db_charset.'\');
    282 define(\'DB_COLLATE\',  \'\');
    283 '.substr($config_file_contents, $php_end_tag);
    284 
    285   $fp = @fopen( $config_file, 'w' );
    286   @fputs($fp, $config_file_contents, strlen($config_file_contents));
    287   @fclose($fp);
     262define(\'DB_COLLATE\',  \'\');'
     263  );
    288264
    289265  foreach ($all_langs as $old_lang=>$lang_data)
  • trunk/install/upgrade_1.3.1.php

    r2838 r2863  
    596596}
    597597
    598 // Insert define('PHPWG_INSTALLED', true); in mysql.inc.php
    599 $config_file_contents =
    600     substr($config_file_contents, 0, $php_end_tag).'
    601 define(\'PHPWG_INSTALLED\', true);
    602 '.substr($config_file_contents, $php_end_tag);
    603 
    604 $fp = @fopen( $config_file, 'w' );
    605 @fputs($fp, $config_file_contents, strlen($config_file_contents));
    606 @fclose($fp);
     598// changes to write in mysql.inc.php
     599array_push($mysql_changes, 'define(\'PHPWG_INSTALLED\', true);');
    607600
    608601// Send infos
  • trunk/language/de_DE/upgrade.lang.php

    r2838 r2863  
    3232$lang['SQL queries'] = 'SQL queries';
    3333$lang['Upgrade informations'] = 'Upgrade informations';
    34 $lang['delete upgrade files'] = '[Security] Delete files "upgrade.php", "upgrade_feed.php", "install.php" and "install" directory';
    3534$lang['perform a maintenance check'] = 'Perform a maintenance check in [Administration>Specials>Maintenance] if you encounter any problem.';
    3635$lang['deactivated plugins'] = 'As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:';
    3736$lang['upgrade login message'] = 'Only administrator can run upgrade: please sign in below.';
    3837$lang['You do not have access rights to run upgrade'] = 'You do not have access rights to run upgrade';
     38$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
    3939
    4040// Upgrade informations from upgrade_1.3.1.php
  • trunk/language/en_UK/upgrade.lang.php

    r2854 r2863  
    3131$lang['SQL queries'] = 'SQL queries';
    3232$lang['Upgrade informations'] = 'Upgrade informations';
    33 $lang['delete upgrade files'] = '[Security] Delete files "upgrade.php", "upgrade_feed.php", "install.php" and "install" directory';
    3433$lang['perform a maintenance check'] = 'Perform a maintenance check in [Administration>Specials>Maintenance] if you encounter any problem.';
    3534$lang['deactivated plugins'] = 'As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:';
    3635$lang['upgrade login message'] = 'Only administrator can run upgrade: please sign in below.';
    3736$lang['You do not have access rights to run upgrade'] = 'You do not have access rights to run upgrade';
     37$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
    3838
    3939// Upgrade informations from upgrade_1.3.1.php
  • trunk/language/es_ES/upgrade.lang.php

    r2844 r2863  
    3131$lang['SQL queries'] = 'número de demanda SQL';
    3232$lang['Upgrade informations'] = 'Informaciones sobre la puesta al día';
    33 $lang['delete upgrade files'] = '[Seguridad] Borre los ficheros "upgrade.php", "upgrade_feed.php", "install.php" así como el expediente "install"';
    3433$lang['perform a maintenance check'] = 'Por favor, efectúes un mantenimiento en [Administración>Especiales>Mantenimiento] si usted encuentra problemas.';
    3534$lang['deactivated plugins'] = 'Por precaución, el plugins siguiente han sido desactivados. Verifique si existen unas posturas al día antes de reactivarlas:';
    3635$lang['upgrade login message'] = 'Sólo un administrador puede lanzar la puesta al día: por favor, identifiqúese más abajo.';
    3736$lang['You do not have access rights to run upgrade'] = 'Usted no tiene los derechos necessaires para lanzar la puesta al día.';
     37/* TODO */$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
    3838
    3939// Upgrade informations from upgrade_1.3.1.php
  • trunk/language/fr_FR/upgrade.lang.php

    r2854 r2863  
    3131$lang['SQL queries'] = 'nombre de requêtes SQL';
    3232$lang['Upgrade informations'] = 'Informations sur la mise à jour';
    33 $lang['delete upgrade files'] = '[Sécurité] Effacez les fichiers "upgrade.php", "upgrade_feed.php", "install.php" ainsi que le dossier "install"';
    3433$lang['perform a maintenance check'] = 'Veuillez effectuer une maintenance dans [Administration>Spéciales>Maintenance] si vous rencontrez des problèmes.';
    3534$lang['deactivated plugins'] = 'Par précaution, les plugins suivants ont été désactivés. Vérifiez s\'il existe des mises à jour avant de les réactiver:';
    36 $lang['upgrade login message'] = 'Seul un adminitrateur peut lancer la mise à jour: veuillez vous identifier ci-dessous.';
     35$lang['upgrade login message'] = 'Seul un administrateur peut lancer la mise à jour: veuillez vous identifier ci-dessous.';
    3736$lang['You do not have access rights to run upgrade'] = 'Vous n\'avez pas les droits necessaires pour lancer la mise à jour.';
     37$lang['in include/mysql.inc.php, before ?>, insert:'] = 'Dans le fichier <i>include/mysql.inc.php</i>, avant <b>?></b>, insérez:';
    3838
    3939// Upgrade informations from upgrade_1.3.1.php
  • trunk/language/it_IT/upgrade.lang.php

    r2854 r2863  
    3131$lang['SQL queries'] = 'numero delle esecuzioni SQL';
    3232$lang['Upgrade informations'] = 'Informazioni sul\'aggiornamento';
    33 $lang['delete upgrade files'] = '[Sicurezza] Cancellare i files "upgrade.php", "upgrade_feed.php", "install.php" e la directory "install"';
    3433$lang['perform a maintenance check'] = 'Se riscontrate dei problemi, effettuare una manutezione in [Amministrazione>Speciale>Manutenzione].';
    3534$lang['deactivated plugins'] = 'Per precauzione, i plugins sono stati disattivati. Verificate se non esistono degli aggiornamenti prima di riattivarli:';
    3635$lang['upgrade login message'] = 'Solo un\'amministratore può eseguire l\'aggiornamento: identificatevi.';
    3736$lang['You do not have access rights to run upgrade'] = 'Non avete le autorizzazioni necessarie per effettuare l\'aggiornamento';
     37/* TODO */$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
    3838
    3939// Upgrade informations from upgrade_1.3.1.php
  • trunk/language/nl_NL/upgrade.lang.php

    r2854 r2863  
    3232$lang['SQL queries'] = 'SQL queries';
    3333$lang['Upgrade informations'] = 'Upgrade informations';
    34 $lang['delete upgrade files'] = '[Security] Delete files "upgrade.php", "upgrade_feed.php", "install.php" and "install" directory';
    3534$lang['perform a maintenance check'] = 'Perform a maintenance check in [Administration>Specials>Maintenance] if you encounter any problem.';
    3635$lang['deactivated plugins'] = 'As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:';
    3736$lang['upgrade login message'] = 'Only administrator can run upgrade: please sign in below.';
    3837$lang['You do not have access rights to run upgrade'] = 'You do not have access rights to run upgrade';
     38$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
    3939
    4040// Upgrade informations from upgrade_1.3.1.php
  • trunk/upgrade.php

    r2862 r2863  
    3030define('PHPWG_ROOT_PATH', './');
    3131
    32 if (!file_exists(PHPWG_ROOT_PATH.'include/mysql.inc.php'))
    33 {
    34   die('Could not find include/mysql.inc.php file.');
     32// load config file
     33$config_file = PHPWG_ROOT_PATH.'include/mysql.inc.php';
     34$config_file_contents = @file_get_contents($config_file);
     35if ($config_file_contents === false)
     36{
     37  die('Cannot load '.$config_file);
     38}
     39$php_end_tag = strrpos($config_file_contents, '?'.'>');
     40if ($php_end_tag === false)
     41{
     42  die('Cannot find php end tag in '.$config_file);
    3543}
    3644
     
    225233$page['infos'] = array();
    226234$page['errors'] = array();
     235$mysql_changes = array();
    227236
    228237if (isset($_POST['username']) and isset($_POST['password']))
     
    239248    $conf['die_on_sql_error'] = false;
    240249    include($upgrade_file);
     250
     251    // Something to add in mysql.inc.php?
     252    if (!empty($mysql_changes))
     253    {
     254      $config_file_contents =
     255        substr($config_file_contents, 0, $php_end_tag) . "\r\n"
     256        . implode("\r\n\r\n" , $mysql_changes) . "\r\n"
     257        . substr($config_file_contents, $php_end_tag);
     258
     259      if (!@file_put_contents($config_file, $config_file_contents))
     260      {
     261        array_push($page['infos'],
     262          l10n('in include/mysql.inc.php, before ?>, insert:') . '
     263<p><textarea rows="5" cols="40">'.implode("\r\n\r\n" , $mysql_changes).'</textarea></p>'
     264          );
     265      }
     266    }
    241267
    242268    // Plugins deactivation
     
    270296
    271297    array_push($page['infos'],
    272       l10n('delete upgrade files'),
    273298      l10n('perform a maintenance check')
    274299      );
Note: See TracChangeset for help on using the changeset viewer.