@@ 126-145 (lines=20) @@ | ||
123 | * |
|
124 | * @return mixed |
|
125 | */ |
|
126 | function update_userlog_v115(XoopsModule $module) |
|
127 | { |
|
128 | $userlog = Userlog::getInstance(); |
|
129 | // Only change the field from INDEX to UNIQUE if it is not unique |
|
130 | // if (isset($indexArr[0]["Non_unique"]) || $indexArr[0]["Non_unique"] == 1) { } |
|
131 | // change the index in _stats table |
|
132 | if (!$ret = $userlog->getHandler('stats')->changeIndex('stats_type_link_period', ['stats_type', 'stats_link', 'stats_period'], 'UNIQUE')) { |
|
133 | $module->setErrors("'stats_type_link_period' index is not changed to unique. Warning: do not use module until you change this index to unique."); |
|
134 | } |
|
135 | // drop the index in _log table |
|
136 | if (!$ret = $userlog->getHandler('log')->dropIndex('log_id_uid')) { |
|
137 | $module->setErrors("'log_id_uid' index is not dropped."); |
|
138 | } |
|
139 | // add the index in _log table |
|
140 | if (!$ret = $userlog->getHandler('log')->addIndex('log_time', ['log_time'])) { |
|
141 | $module->setErrors("'log_time' index is not added."); |
|
142 | } |
|
143 | ||
144 | return $ret; |
|
145 | } |
|
146 | ||
147 | /** |
|
148 | * @param XoopsModule $module |
@@ 115-134 (lines=20) @@ | ||
112 | * |
|
113 | * @return mixed |
|
114 | */ |
|
115 | function update_userlog_v115(XoopsModule $module) |
|
116 | { |
|
117 | $userlog = Userlog::getInstance(); |
|
118 | // Only change the field from INDEX to UNIQUE if it is not unique |
|
119 | // if (isset($indexArr[0]["Non_unique"]) || $indexArr[0]["Non_unique"] == 1) { } |
|
120 | // change the index in _stats table |
|
121 | if (!$ret = $userlog->getHandler('stats')->changeIndex('stats_type_link_period', ['stats_type', 'stats_link', 'stats_period'], 'UNIQUE')) { |
|
122 | $module->setErrors("'stats_type_link_period' index is not changed to unique. Warning: do not use module until you change this index to unique."); |
|
123 | } |
|
124 | // drop the index in _log table |
|
125 | if (!$ret = $userlog->getHandler('log')->dropIndex('log_id_uid')) { |
|
126 | $module->setErrors("'log_id_uid' index is not dropped."); |
|
127 | } |
|
128 | // add the index in _log table |
|
129 | if (!$ret = $userlog->getHandler('log')->addIndex('log_time', ['log_time'])) { |
|
130 | $module->setErrors("'log_time' index is not added."); |
|
131 | } |
|
132 | ||
133 | return $ret; |
|
134 | } |
|
135 | ||
136 | /** |
|
137 | * @param XoopsModule $module |