-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.rsgallery2.php
53 lines (43 loc) · 1.6 KB
/
install.rsgallery2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* This file contains the install routine for RSGallery2
* @version $Id: install.rsgallery2.php 1010 2011-01-26 15:26:17Z mirjam $
* @package RSGallery2
* @copyright (C) 2003 - 2006 RSGallery2
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* RSGallery is Free Software
**/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
function com_install(){
$database =& JFactory::getDBO();
$lang =& JFactory::getLanguage();
$lang->load('com_rsgallery2');
require_once( JPATH_ADMINISTRATOR . '/components/com_rsgallery2/includes/install.class.php' );
//Initialize install
$rsgInstall = new rsgInstall();
//Change the menu icon
$rsgInstall->changeMenuIcon();
//Initialize rsgallery migration
$migrate_com_rsgallery = new migrate_com_rsgallery();
//If previous version detected
if( $migrate_com_rsgallery->detect() ){
// now that we know a previous rsg2 was installed, we need to reload it's config
global $rsgConfig;
$rsgConfig = new rsgConfig();
$rsgInstall->writeInstallMsg( JText::_('Migrating from RSGallery2') .' '. $rsgConfig->get( 'version' ), 'ok');
//Migrate from earlier version
$result = $migrate_com_rsgallery->migrate();
if( $result === true ){
$rsgInstall->writeInstallMsg( JText::_('SUCCESS NOW USING RSGALLERY2').' '. $rsgConfig->get( 'version' ), 'ok');
}
else{
$result = print_r( $result, true );
$rsgInstall->writeInstallMsg( JText::_('FAILURE-')."\n<br><pre>$result\n</pre>", 'error');
}
}
else{
//No earlier version detected, do a fresh install
$rsgInstall->freshInstall();
}
}