| 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 (https://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: | $result = $xoopsDB->queryF($sql); |
| 29: | if (!$xoopsDB->isResultSet($result)) { |
| 30: | return false; |
| 31: | } |
| 32: | |
| 33: | // Migrate from existent pm module |
| 34: | if (($rows = $xoopsDB->getRowsNum($result)) == 12) { |
| 35: | return true; |
| 36: | } elseif ($rows == 8) { |
| 37: | return $xoopsDB->queryFromFile(XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/sql/mysql.upgrade.sql'); |
| 38: | } else { |
| 39: | return false; |
| 40: | } |
| 41: | } |
| 42: |