Changeset 6196


Ignore:
Timestamp:
May 16, 2010, 5:57:12 PM (10 years ago)
Author:
patdenice
Message:

Webmaster status is required to launch any upgrade process.
Display "save template directory" fielset only if Piwigo version < 2.1.
Add random parameter in all_version url (to avoid cache server).
Move empty directory to trash is rmdir fail.

Location:
extensions/autoupdate/trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • extensions/autoupdate/trunk/autoupdate.php

    r6181 r6196  
    11<?php
     2
     3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    24
    35include(AUTOUPDATE_PATH.'include/functions.inc.php');
     
    2729  if (preg_match('/(\d+\.\d+)\.(\d+)/', PHPWG_VERSION, $matches))
    2830  {
    29     if (@fetchRemote(PHPWG_URL.'/download/all_versions.php', $result)
     31    $url = PHPWG_URL.'/download/all_versions.php';
     32    $url .= '?rand='.md5(uniqid(rand(), true)); // Avoid server cache
     33
     34    if (@fetchRemote($url, $result)
    3035      and $all_versions = @explode("\n", $result)
    3136      and is_array($all_versions))
     
    8893// |                                Step 2                                 |
    8994// +-----------------------------------------------------------------------+
    90 if ($step == 2)
     95if ($step == 2 and is_webmaster())
    9196{
    9297  if (isset($_POST['submit']) and isset($_POST['upgrade_to']))
     
    99104// |                                Step 3                                 |
    100105// +-----------------------------------------------------------------------+
    101 if ($step == 3)
     106if ($step == 3 and is_webmaster())
    102107{
    103   if (isset($_POST['saveTemplate']))
     108  if (isset($_POST['saveTemplate']) and version_compare(PHPWG_VERSION, '2.1', '<'))
    104109  {
    105110    autoupdate_save_template_dir();
     
    121126// +-----------------------------------------------------------------------+
    122127
     128if (!is_webmaster())
     129{
     130  array_push($page['errors'], l10n('Webmaster status is required.'));
     131}
     132
    123133$template->assign(array(
    124   'STEP'        => $step,
    125   'AU_URL'      => get_admin_plugin_menu_link(AUTOUPDATE_PATH . '/autoupdate.php'),
    126   'UPGRADE_TO'  => $upgrade_to,
    127   'RELEASE_URL' => PHPWG_URL.'/releases/'.$upgrade_to,
     134  'STEP'          => $step,
     135  'AU_URL'        => get_admin_plugin_menu_link(AUTOUPDATE_PATH . '/autoupdate.php'),
     136  'PHPWG_VERSION' => PHPWG_VERSION,
     137  'UPGRADE_TO'    => $upgrade_to,
     138  'RELEASE_URL'   => PHPWG_URL.'/releases/'.$upgrade_to,
    128139  )
    129140);
  • extensions/autoupdate/trunk/include/functions.inc.php

    r6181 r6196  
    11<?php
    22
    3 function autoupdate_deltree($path)
     3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     4
     5function autoupdate_deltree($path, $move_to_trash=false)
    46{
    57  if (is_dir($path))
     
    1315        if (is_dir($pathfile))
    1416        {
    15           autoupdate_deltree($pathfile);
     17          autoupdate_deltree($pathfile, $move_to_trash);
    1618        }
    1719        else
     
    2224    }
    2325    closedir($fh);
    24     return @rmdir($path);
     26    if (@rmdir($path))
     27    {
     28      return true;
     29    }
     30    elseif ($move_to_trash)
     31    {
     32      $trash = PHPWG_ROOT_PATH.'_trash';
     33      if (!is_dir($trash))
     34      {
     35        @mkgetdir($trash);
     36      }
     37      return @rename($path, $trash . '/'.md5(uniqid(rand(), true)));
     38    }
     39    else
     40    {
     41      return false;
     42    }
    2543  }
    2644}
     
    6583      elseif (is_dir($path))
    6684      {
    67         autoupdate_deltree($path);
     85        autoupdate_deltree($path, true);
    6886      }
    6987    }
     
    399417}
    400418
     419if (!function_exists('is_webmaster'))
     420{
     421  function is_webmaster($user_status = '')
     422  {
     423    return is_autorize_status(ACCESS_WEBMASTER, $user_status);
     424  }
     425}
     426
    401427define('AU_DEFAULT_INDEX', file_get_contents(AUTOUPDATE_PATH.'index.php'));
    402428?>
  • extensions/autoupdate/trunk/include/functions_remote.inc.php

    r6167 r6196  
    11<?php
     2
     3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    24
    35function autoupdate_check_version($version=PHPWG_VERSION)
  • extensions/autoupdate/trunk/language/cs_CZ/plugin.lang.php

    r6181 r6196  
    2828/*TODO*/$lang['Some themes and plugins may be not available yet.'] = 'Some themes and plugins may be not available yet.';
    2929/*TODO*/$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).';
    30 /*TODO*/$lang['First Step'] = 'First Step';
    31 /*TODO*/$lang['Second Step'] = 'Second Step';
    32 /*TODO*/$lang['Third Step'] = 'Third Step';
     30/*TODO*/$lang['autoupdate_step_1'] = 'First Step';
     31/*TODO*/$lang['autoupdate_step_2'] = 'Second Step';
     32/*TODO*/$lang['autoupdate_step_3'] = 'Third Step';
    3333/*TODO*/$lang['Save Template Directory'] = 'Save template directory';
    3434/*TODO*/$lang['Dump Database'] = 'Dump Database';
  • extensions/autoupdate/trunk/language/de_DE/plugin.lang.php

    r6184 r6196  
    2828$lang['Some themes and plugins may be not available yet.'] = 'Einige Themen und Plugins sind dadurch nicht mehr verwendbar.';
    2929$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'Sie können direkt auf Version %s aktualisieren und Version %s überspringen (empfohlen).';
    30 $lang['First Step'] = 'Erster Schritt';
    31 $lang['Second Step'] = 'Zweiter Schritt';
    32 $lang['Third Step'] = 'Dritter Schritt';
     30$lang['autoupdate_step_1'] = 'Erster Schritt';
     31$lang['autoupdate_step_2'] = 'Zweiter Schritt';
     32$lang['autoupdate_step_3'] = 'Dritter Schritt';
    3333$lang['Save Template Directory'] = 'Sichere den Templateordner';
    3434$lang['Dump Database'] = 'Exportiere die Datenbank';
  • extensions/autoupdate/trunk/language/en_UK/plugin.lang.php

    r6181 r6196  
    2828$lang['Some themes and plugins may be not available yet.'] = 'Some themes and plugins may be not available yet.';
    2929$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).';
    30 $lang['First Step'] = 'First Step';
    31 $lang['Second Step'] = 'Second Step';
    32 $lang['Third Step'] = 'Third Step';
     30$lang['autoupdate_step_1'] = 'First Step';
     31$lang['autoupdate_step_2'] = 'Second Step';
     32$lang['autoupdate_step_3'] = 'Third Step';
    3333$lang['Save Template Directory'] = 'Save template directory';
    3434$lang['Dump Database'] = 'Dump Database';
  • extensions/autoupdate/trunk/language/es_ES/plugin.lang.php

    r6191 r6196  
    2828$lang['Some themes and plugins may be not available yet.'] = 'Algunos temas y plugins pueden no estar disponibles todavía.';
    2929$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'Puede actualizar a Piwigo% s directamente, sin actualizar a Piwigo %s (recomendado).';
    30 $lang['First Step'] = 'Primer paso';
    31 $lang['Second Step'] = 'Segundo Paso';
    32 $lang['Third Step'] = 'Tercer paso';
     30$lang['autoupdate_step_1'] = 'Primer paso';
     31$lang['autoupdate_step_2'] = 'Segundo Paso';
     32$lang['autoupdate_step_3'] = 'Tercer paso';
    3333$lang['Save Template Directory'] = 'Guardar directorio de plantillas';
    3434$lang['Dump Database'] = 'Volcar la base de datos';
  • extensions/autoupdate/trunk/language/fr_FR/plugin.lang.php

    r6181 r6196  
    2828$lang['Some themes and plugins may be not available yet.'] = 'Certains thèmes ou plugins ne sont peut-être pas encore disponibles.';
    2929$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'Vous pouvez mettre à jour vers Piwigo %s directement, sans passer par Piwigo %s (recommandé).';
    30 $lang['First Step'] = 'Première étape';
    31 $lang['Second Step'] = 'Deuxième étape';
    32 $lang['Third Step'] = 'Troisième étape';
     30$lang['autoupdate_step_1'] = 'Première étape';
     31$lang['autoupdate_step_2'] = 'Deuxième étape';
     32$lang['autoupdate_step_3'] = 'Troisième étape';
    3333$lang['Save Template Directory'] = 'Sauvegarder le dossier template';
    3434$lang['Dump Database'] = 'Sauvegarder la base de données';
  • extensions/autoupdate/trunk/language/hr_HR/plugin.lang.php

    r6181 r6196  
    2828/*TODO*/$lang['Some themes and plugins may be not available yet.'] = 'Some themes and plugins may be not available yet.';
    2929/*TODO*/$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).';
    30 /*TODO*/$lang['First Step'] = 'First Step';
    31 /*TODO*/$lang['Second Step'] = 'Second Step';
    32 /*TODO*/$lang['Third Step'] = 'Third Step';
     30/*TODO*/$lang['autoupdate_step_1'] = 'First Step';
     31/*TODO*/$lang['autoupdate_step_2'] = 'Second Step';
     32/*TODO*/$lang['autoupdate_step_3'] = 'Third Step';
    3333/*TODO*/$lang['Save Template Directory'] = 'Save template directory';
    3434/*TODO*/$lang['Dump Database'] = 'Dump Database';
  • extensions/autoupdate/trunk/language/hu_HU/plugin.lang.php

    r6192 r6196  
    2929$lang['Some themes and plugins may be not available yet.'] = 'Lehet, hogy néhány téma és bővítmény még nem áll rendelkezésre.';
    3030$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'Lehetősége van közvetlenül frissíteni a Piwigo %s verziójára, kihagyva a Piwigo %s verzióját (ajánlott).';
    31 $lang['First Step'] = 'Első lépés';
    32 $lang['Second Step'] = 'Második lépés';
    33 $lang['Third Step'] = 'Harmadik lépés';
     31$lang['autoupdate_step_1'] = 'Első lépés';
     32$lang['autoupdate_step_2'] = 'Második lépés';
     33$lang['autoupdate_step_3'] = 'Harmadik lépés';
    3434$lang['Save Template Directory'] = 'Template könyvtár mentése';
    3535$lang['Dump Database'] = 'Adatbázis mentése';
  • extensions/autoupdate/trunk/language/it_IT/plugin.lang.php

    r6182 r6196  
    2828$lang['Some themes and plugins may be not available yet.'] = 'Alcuni temi e plugin possono non essere ancora disponibili.';
    2929$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'E\' possibile aggiornare a Piwigo %s direttamente, senza passare a Piwigo %s (consigliato).';
    30 $lang['First Step'] = 'Primo passo';
    31 $lang['Second Step'] = 'Secondo passo';
    32 $lang['Third Step'] = 'Terzo passo';
     30$lang['autoupdate_step_1'] = 'Primo passo';
     31$lang['autoupdate_step_2'] = 'Secondo passo';
     32$lang['autoupdate_step_3'] = 'Terzo passo';
    3333$lang['Save Template Directory'] = 'Salvare la template directory';
    3434$lang['Dump Database'] = 'Salvare Database';
  • extensions/autoupdate/trunk/language/ja_JP/plugin.lang.php

    r6181 r6196  
    2828/*TODO*/$lang['Some themes and plugins may be not available yet.'] = 'Some themes and plugins may be not available yet.';
    2929/*TODO*/$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).';
    30 /*TODO*/$lang['First Step'] = 'First Step';
    31 /*TODO*/$lang['Second Step'] = 'Second Step';
    32 /*TODO*/$lang['Third Step'] = 'Third Step';
     30/*TODO*/$lang['autoupdate_step_1'] = 'First Step';
     31/*TODO*/$lang['autoupdate_step_2'] = 'Second Step';
     32/*TODO*/$lang['autoupdate_step_3'] = 'Third Step';
    3333/*TODO*/$lang['Save Template Directory'] = 'Save template directory';
    3434/*TODO*/$lang['Dump Database'] = 'Dump Database';
  • extensions/autoupdate/trunk/language/nl_NL/plugin.lang.php

    r6186 r6196  
    2828$lang['Some themes and plugins may be not available yet.'] = 'Sommige thema\'s en plugins zijn mogelijk nog niet beschikbaar.';
    2929$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'U kunt direct upgraden naar Piwigo versie %s, zonder eerst te upgraden naar Piwigo versie %s (aanbevolen).';
    30 $lang['First Step'] = 'Eerste stap';
    31 $lang['Second Step'] = 'Tweede stap';
    32 $lang['Third Step'] = 'Derde stap';
     30$lang['autoupdate_step_1'] = 'Eerste stap';
     31$lang['autoupdate_step_2'] = 'Tweede stap';
     32$lang['autoupdate_step_3'] = 'Derde stap';
    3333$lang['Save Template Directory'] = 'Bewaar de template directory';
    3434$lang['Dump Database'] = 'Dump de database';
  • extensions/autoupdate/trunk/language/pl_PL/plugin.lang.php

    r6181 r6196  
    2828/*TODO*/$lang['Some themes and plugins may be not available yet.'] = 'Some themes and plugins may be not available yet.';
    2929/*TODO*/$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).';
    30 /*TODO*/$lang['First Step'] = 'First Step';
    31 /*TODO*/$lang['Second Step'] = 'Second Step';
    32 /*TODO*/$lang['Third Step'] = 'Third Step';
     30/*TODO*/$lang['autoupdate_step_1'] = 'First Step';
     31/*TODO*/$lang['autoupdate_step_2'] = 'Second Step';
     32/*TODO*/$lang['autoupdate_step_3'] = 'Third Step';
    3333/*TODO*/$lang['Save Template Directory'] = 'Save template directory';
    3434/*TODO*/$lang['Dump Database'] = 'Dump Database';
  • extensions/autoupdate/trunk/language/ru_RU/plugin.lang.php

    r6181 r6196  
    2828/*TODO*/$lang['Some themes and plugins may be not available yet.'] = 'Some themes and plugins may be not available yet.';
    2929/*TODO*/$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).';
    30 /*TODO*/$lang['First Step'] = 'First Step';
    31 /*TODO*/$lang['Second Step'] = 'Second Step';
    32 /*TODO*/$lang['Third Step'] = 'Third Step';
     30/*TODO*/$lang['autoupdate_step_1'] = 'First Step';
     31/*TODO*/$lang['autoupdate_step_2'] = 'Second Step';
     32/*TODO*/$lang['autoupdate_step_3'] = 'Third Step';
    3333/*TODO*/$lang['Save Template Directory'] = 'Save template directory';
    3434/*TODO*/$lang['Dump Database'] = 'Dump Database';
  • extensions/autoupdate/trunk/language/vi_VN/plugin.lang.php

    r6185 r6196  
    2828$lang['Some themes and plugins may be not available yet.'] = 'M?t s? themes và plugins có th? chua dùng du?c.';
    2929$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = 'B?n có th? nâng c?p tr?c ti?p lên phiên b?n Piwigo %s, mà không c?n ph?i nâng c?p t? phiên b?n %s (khuy?n cáo).';
    30 $lang['First Step'] = 'Bu?c th? nh?t';
    31 $lang['Second Step'] = 'Bu?c th? 2';
    32 $lang['Third Step'] = 'Bu?c th? 3';
     30$lang['autoupdate_step_1'] = 'Bu?c th? nh?t';
     31$lang['autoupdate_step_2'] = 'Bu?c th? 2';
     32$lang['autoupdate_step_3'] = 'Bu?c th? 3';
    3333$lang['Save Template Directory'] = 'Luu l?i template c?a thu m?c';
    3434$lang['Dump Database'] = 'T?o b?n sao co s? d? li?u';
  • extensions/autoupdate/trunk/language/zh_CN/plugin.lang.php

    r6183 r6196  
    2828$lang['Some themes and plugins may be not available yet.'] = '一些主题和插件也许还未能用.';
    2929$lang['You can upgrade to Piwigo %s directly, without upgrading to Piwigo %s (recommended).'] = '您可以直接升级到 Piwigo %s , 而并不需要先升级到 Piwigo %s (recommended).';
    30 $lang['First Step'] = '第一步';
    31 $lang['Second Step'] = '第二步';
    32 $lang['Third Step'] = '第三步';
     30$lang['autoupdate_step_1'] = '第一步';
     31$lang['autoupdate_step_2'] = '第二步';
     32$lang['autoupdate_step_3'] = '第三步';
    3333$lang['Save Template Directory'] = '保存模板目录';
    3434$lang['Dump Database'] = '转存数据库';
  • extensions/autoupdate/trunk/maintain.inc.php

    r6168 r6196  
    1515}
    1616
    17 function plugin_deactivate()
     17function plugin_uninstall()
    1818{
    1919  global $prefixeTable;
  • extensions/autoupdate/trunk/plugins_update.php

    r6181 r6196  
    11<?php
     2
     3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    24
    35function autoupdate_plugins_update_filter($content, &$smarty)
  • extensions/autoupdate/trunk/template/autoupdate.tpl

    r6181 r6196  
    5656</p>
    5757<form action="" method="post">
     58
     59{if version_compare($PHPWG_VERSION, '2.1', '<')}
     60{counter assign=i}
    5861<fieldset>
    59   <legend>{'First Step'|@translate}</legend>
     62  <legend>{'autoupdate_step_'|cat:$i|@translate}</legend>
    6063  <p><input type="submit" name="saveTemplate" value="{'Save Template Directory'|@translate}"></p>
    6164</fieldset>
     65{/if}
     66
     67{counter assign=i}
    6268<fieldset>
    63   <legend>{'Second Step'|@translate}</legend>
     69  <legend>{'autoupdate_step_'|cat:$i|@translate}</legend>
    6470  <p><input type="checkbox" name="includeHistory"> &nbsp; {'Include history data (Warning: server memory limit may be exceeded)'|@translate}</p>
    6571  <p><input type="submit" name="dumpDatabase" value="{'Dump Database'|@translate}"></p>
    6672</fieldset>
     73
     74{counter assign=i}
    6775<fieldset>
    68   <legend>{'Third Step'|@translate|@sprintf:$UPGRADE_TO}</legend>
     76  <legend>{'autoupdate_step_'|cat:$i|@translate}</legend>
    6977  <p><input type="submit" name="submit" value="{'Upgrade to Piwigo %s'|@translate|@sprintf:$UPGRADE_TO}" onClick="return confirm('{'autoupdate_alert'|@translate}');"></p>
    7078</fieldset>
     79
    7180<p><input type="hidden" name="upgrade_to" value="{$UPGRADE_TO}"></p>
    7281</form>
Note: See TracChangeset for help on using the changeset viewer.