1: <?php
2: /**
3: * Private Message
4: *
5: * You may not change or alter any portion of this comment or credits
6: * of supporting developers from this source code or any supporting source code
7: * which is considered copyrighted (c) material of the original comment or credit authors.
8: * This program is distributed in the hope that it will be useful,
9: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11: *
12: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
13: * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
14: * @package pm
15: * @since 2.3.0
16: * @author Taiwen Jiang <phppp@users.sourceforge.net>
17: * @param $module
18: * @return bool
19: */
20:
21: function xoops_module_install_pm(XoopsModule $module)
22: {
23:
24: global $xoopsDB;
25:
26: // Check pm table version
27: $sql = 'SHOW COLUMNS FROM ' . $xoopsDB->prefix('priv_msgs');
28: if (!$result = $xoopsDB->queryF($sql)) {
29: return false;
30: }
31: // Migrate from existent pm module
32: if (($rows = $xoopsDB->getRowsNum($result)) == 12) {
33: return true;
34: } elseif ($rows == 8) {
35: return $xoopsDB->queryFromFile(XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/sql/mysql.upgrade.sql');
36: } else {
37: return false;
38: }
39: }
40: