Ignore:
Timestamp:
May 8, 2012, 4:18:51 PM (12 years ago)
Author:
Eric
Message:

Fist 1.0.0 release

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Prune_History/admin/PH_admin.php

    r14838 r14854  
    1818$page['global'] = array();
    1919$range = array();
     20$dump_download = '';
    2021
    21 // +-----------------------------------------------------------------------+
    22 // |                      Getting plugin version                           |
    23 // +-----------------------------------------------------------------------+
     22
     23// +-------------------------------------------------------------------+
     24// |                      Get plugin version and name                  |
     25// +-------------------------------------------------------------------+
    2426$plugin =  PHInfos(PH_PATH);
    2527$version = $plugin['version'];
     
    4547}
    4648
     49
     50// +--------------------------------------------------------------------+
     51// |                     Saving history tables                          |
     52// +--------------------------------------------------------------------+
     53if (isset($_POST['save']))
     54{
     55  $dump_download = (isset($_POST['dump_download'])) ? 'true' : 'false';
     56   
     57  if(PH_dump($dump_download) and $dump_download == 'false')
     58  {
     59    array_push($page['infos'], l10n('PH_Dump_OK'));
     60  }
     61  else
     62  {
     63    array_push($page['errors'], l10n('PH_Dump_NOK'));
     64  }
     65}
     66
     67
     68// +--------------------------------------------------------------------+
     69// |             Restoring backed up history tables                     |
     70// +--------------------------------------------------------------------+
     71if (isset($_POST['restore']))
     72{
     73  $Backup_File = PH_PATH.'/include/backup/PH_Historybackup.sql';
     74
     75  if (file_exists($Backup_File) and $file = file($Backup_File, FILE_IGNORE_NEW_LINES) and !empty($file))
     76  {
     77    // Check backup file version
     78    // -------------------------
     79    if ($file[0] == "-- ".$version." --")
     80    {
     81      $restore = PH_Restore_backup_file();
     82      if(empty($restore))
     83      {
     84        array_push($page['infos'], l10n('PH_Restoration_OK'));
     85      }
     86      else
     87      {
     88        array_push($page['errors'], l10n('PH_Restoration_NOK'));
     89      }
     90    }
     91    else array_push($page['errors'], l10n('PH_Bad_version_backup'));
     92  }
     93  else
     94  {
     95    array_push($page['errors'], l10n('PH_No_Backup_File'));
     96  }
     97}
     98
     99
     100// +--------------------------------------------------------------------+
     101// |                      Manual prune settings                         |
     102// +--------------------------------------------------------------------+
    47103$conf_PH = unserialize($conf['PruneHistory']);
    48104
     
    87143}
    88144
     145
    89146// +-----------------------------------------------------------------------+
    90147// |                           templates init                              |
     
    104161    'PH_NAME'                    => $name,
    105162    'PH_VERSION'                 => $version,
     163    'PH_DUMP_DOWNLOAD'           => $dump_download,
    106164                'PH_AUTOPRUNE_TRUE'          => $conf_PH[1]=='true' ? 'checked="checked"' : '' ,
    107165                'PH_AUTOPRUNE_FALSE'         => $conf_PH[1]=='false' ? 'checked="checked"' : '' ,
     
    119177);
    120178
     179
    121180// +-----------------------------------------------------------------------+
    122181// |                           templates display                           |
Note: See TracChangeset for help on using the changeset viewer.