Changeset 601 for trunk/lib/ACL.inc.php


Ignore:
Timestamp:
Apr 27, 2017 4:43:35 PM (7 years ago)
Author:
anonymous
Message:

Updated every instance of 'zero' date 0000-00-00 to use 1000-01-01 if mysql version >= 5.7.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/ACL.inc.php

    r534 r601  
    162162
    163163            // acl_tbl
    164             $db->query("
     164            $db->query(sprintf("
    165165                CREATE TABLE IF NOT EXISTS acl_tbl (
    166166                    aro_id SMALLINT UNSIGNED NOT NULL DEFAULT '0',
     
    168168                    axo_id SMALLINT UNSIGNED NOT NULL DEFAULT '0',
    169169                    access ENUM('allow', 'deny') DEFAULT NULL,
    170                     added_datetime DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
     170                    added_datetime DATETIME NOT NULL DEFAULT '%s 00:00:00',
    171171                    UNIQUE KEY (aro_id, aco_id, axo_id),
    172172                    KEY (access)
    173173                ) ENGINE=MyISAM
    174             ");
     174            ", $db->getParam('zero_date')));
    175175            if (!$db->columnExists('acl_tbl', array(
    176176                'aro_id',
     
    192192            // aro_tbl, aco_tbl, axo_tbl
    193193            foreach (array('aro', 'aco', 'axo') as $a_o) {
    194                 $db->query("
    195                     CREATE TABLE IF NOT EXISTS {$a_o}_tbl (
    196                         {$a_o}_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
    197                         name VARCHAR(" . $this->getParam('name_max_length') . ") NOT NULL DEFAULT '',
     194                $db->query(sprintf("
     195                    CREATE TABLE IF NOT EXISTS %1\$s_tbl (
     196                        %1\$s_id SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
     197                        name VARCHAR(%2\$s) NOT NULL DEFAULT '',
    198198                        lft MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
    199199                        rgt MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
    200                         added_datetime DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
     200                        added_datetime DATETIME NOT NULL DEFAULT '%3\$s 00:00:00',
    201201                        UNIQUE KEY name (name(15)),
    202202                        KEY transversal (lft, rgt)
    203203                    ) ENGINE=MyISAM;
    204                 ");
     204                ", $a_o, $this->getParam('name_max_length'), $db->getParam('zero_date')));
    205205
    206206                if (!$db->columnExists("{$a_o}_tbl", array(
Note: See TracChangeset for help on using the changeset viewer.