mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 09:49:22 +02:00
* auto add z_polls table on install
This commit is contained in:
parent
eeb09ddce6
commit
d17c18cabc
@ -27,7 +27,7 @@ session_start();
|
|||||||
|
|
||||||
define('MYAAC', true);
|
define('MYAAC', true);
|
||||||
define('MYAAC_VERSION', '0.7.10-dev');
|
define('MYAAC_VERSION', '0.7.10-dev');
|
||||||
define('DATABASE_VERSION', 21);
|
define('DATABASE_VERSION', 22);
|
||||||
define('TABLE_PREFIX', 'myaac_');
|
define('TABLE_PREFIX', 'myaac_');
|
||||||
define('START_TIME', microtime(true));
|
define('START_TIME', microtime(true));
|
||||||
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));
|
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));
|
||||||
|
@ -178,14 +178,17 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update config.highscores_ids_hidden
|
// update config.highscores_ids_hidden
|
||||||
require_once(SYSTEM . 'migrations/20.php');
|
|
||||||
$database_migration_20 = true;
|
$database_migration_20 = true;
|
||||||
|
require_once(SYSTEM . 'migrations/20.php');
|
||||||
$content = '';
|
$content = '';
|
||||||
if(!databaseMigration20($content)) {
|
if(!databaseMigration20($content)) {
|
||||||
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.local.php</b>', $locale['step_database_error_file']);
|
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.local.php</b>', $locale['step_database_error_file']);
|
||||||
warning($locale['step_database_error_file'] . '<br/>
|
warning($locale['step_database_error_file'] . '<br/>
|
||||||
<textarea cols="70" rows="10">' . $content . '</textarea>');
|
<textarea cols="70" rows="10">' . $content . '</textarea>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add z_polls tables
|
||||||
|
require_once(SYSTEM . 'migrations/22.php');
|
||||||
|
|
||||||
$locale['step_finish_desc'] = str_replace('$ADMIN_PANEL$', generateLink(ADMIN_URL, $locale['step_finish_admin_panel'], true), $locale['step_finish_desc']);
|
$locale['step_finish_desc'] = str_replace('$ADMIN_PANEL$', generateLink(ADMIN_URL, $locale['step_finish_admin_panel'], true), $locale['step_finish_desc']);
|
||||||
$locale['step_finish_desc'] = str_replace('$HOMEPAGE$', generateLink(BASE_URL, $locale['step_finish_homepage'], true), $locale['step_finish_desc']);
|
$locale['step_finish_desc'] = str_replace('$HOMEPAGE$', generateLink(BASE_URL, $locale['step_finish_homepage'], true), $locale['step_finish_desc']);
|
||||||
|
26
system/migrations/22.php
Normal file
26
system/migrations/22.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if(!tableExist('z_polls'))
|
||||||
|
$db->query('
|
||||||
|
CREATE TABLE `z_polls` (
|
||||||
|
`id` int(11) NOT NULL auto_increment,
|
||||||
|
`question` varchar(255) NOT NULL,
|
||||||
|
`description` varchar(255) NOT NULL,
|
||||||
|
`end` int(11) NOT NULL DEFAULT 0,
|
||||||
|
`start` int(11) NOT NULL DEFAULT 0,
|
||||||
|
`answers` int(11) NOT NULL DEFAULT 0,
|
||||||
|
`votes_all` int(11) NOT NULL DEFAULT 0,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;');
|
||||||
|
|
||||||
|
if(!tableExist('z_polls_answers'))
|
||||||
|
$db->query('
|
||||||
|
CREATE TABLE `z_polls_answers` (
|
||||||
|
`poll_id` int(11) NOT NULL,
|
||||||
|
`answer_id` int(11) NOT NULL,
|
||||||
|
`answer` varchar(255) NOT NULL,
|
||||||
|
`votes` int(11) NOT NULL DEFAULT 0
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;');
|
||||||
|
|
||||||
|
if(!fieldExist('vote', 'accounts'))
|
||||||
|
$db->query('ALTER TABLE `accounts` ADD `vote` INT( 11 ) NOT NULL ;');
|
@ -13,31 +13,6 @@ $title = 'Polls';
|
|||||||
|
|
||||||
/* Polls System By Averatec from pervera.pl & otland.net */
|
/* Polls System By Averatec from pervera.pl & otland.net */
|
||||||
|
|
||||||
if(!tableExist('z_polls'))
|
|
||||||
$db->query('
|
|
||||||
CREATE TABLE `z_polls` (
|
|
||||||
`id` int(11) NOT NULL auto_increment,
|
|
||||||
`question` varchar(255) NOT NULL,
|
|
||||||
`description` varchar(255) NOT NULL,
|
|
||||||
`end` int(11) NOT NULL DEFAULT 0,
|
|
||||||
`start` int(11) NOT NULL DEFAULT 0,
|
|
||||||
`answers` int(11) NOT NULL DEFAULT 0,
|
|
||||||
`votes_all` int(11) NOT NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;');
|
|
||||||
|
|
||||||
if(!tableExist('z_polls_answers'))
|
|
||||||
$db->query('
|
|
||||||
CREATE TABLE `z_polls_answers` (
|
|
||||||
`poll_id` int(11) NOT NULL,
|
|
||||||
`answer_id` int(11) NOT NULL,
|
|
||||||
`answer` varchar(255) NOT NULL,
|
|
||||||
`votes` int(11) NOT NULL DEFAULT 0
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;');
|
|
||||||
|
|
||||||
if(!fieldExist('vote', 'accounts'))
|
|
||||||
$db->query('ALTER TABLE `accounts` ADD `vote` INT( 11 ) NOT NULL ;');
|
|
||||||
|
|
||||||
function getColorByPercent($percent)
|
function getColorByPercent($percent)
|
||||||
{
|
{
|
||||||
if($percent < 15)
|
if($percent < 15)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user