public static function execute() { $success = false; _::echoWriteInfo("Bsm installation started..."); $dbm = new MyMangr_ObjectsModel(); //Create user table if ($dbm->tableExists('BsmUser')) { _::echoWriteInfo("Dropping BsmUser table"); $dbm->execute("DROP TABLE BsmUser"); } _::echoWriteInfo("Creating BsmUser table"); $sql = "CREATE TABLE BsmUser\n (\n id_user VARCHAR (12) NOT NULL COMMENT 'User id, like u001, 88124, ...',\n name VARCHAR (60) NOT NULL COMMENT 'Name of the user',\n surname VARCHAR (120) NOT NULL COMMENT 'Surname of the user',\n email VARCHAR (120) COMMENT 'Email account',\n password CHAR (40) COMMENT 'Password hash',\n status CHAR (100) NOT NULL COMMENT 'Status: A-Active, D-Deactivated',\n auth_class CHAR (100) NOT NULL COMMENT 'Class for authentication',\n auth_method CHAR (1) NOT NULL COMMENT 'Method of Class for authentication',\n cli_allowed TINYINT (1) NOT NULL COMMENT 'Is the user allowed to use CLI?',\n web_allowed TINYINT (1) NOT NULL COMMENT 'Is the user allowed to use WEB?',\n ts_created TIMESTAMP NOT NULL COMMENT 'Timestamp of user creation', \n ts_last_access TIMESTAMP COMMENT 'Timestamp of user last access',\n PRIMARY KEY(\n id_user\n )\n )"; $dbm->execute($sql); if ($dbm->tableExists('BsmUser') == false) { _::echoWriteInfo("Unable to create BsmUser table. Exiting Bsm install."); return $success; } else { _::echoWriteInfo("Table BsmUser succesfullly created"); } //Create profile table if ($dbm->tableExists('BsmProfile')) { _::echoWriteInfo("Dropping BsmProfile table"); $dbm->execute("DROP TABLE BsmProfile"); } _::echoWriteInfo("Creating BsmProfile table"); $sql = "CREATE TABLE BsmProfile\n (\n id_profile INT (11) NOT NULL COMMENT 'Profile identificator',\n profile VARCHAR (60) NOT NULL COMMENT 'Profile name',\n status CHAR (1) NOT NULL COMMENT 'Status: A-Active, D-Deactivated',\n PRIMARY KEY(\n id_profile\n )\n )"; $dbm->execute($sql); if ($dbm->tableExists('BsmProfile') == false) { _::echoWriteInfo("Unable to create BsmProfile table. Exiting Bsm install."); return $success; } else { _::echoWriteInfo("Table BsmProfile succesfullly created"); } $success = true; return $success; }
/** * Show message of failed installation * * @param string $moduleName Name of the installed module */ private static function failedInstall($moduleName) { _::echoWriteInfo(NL . "Module " . $moduleName . " installation failed."); }