/** * Creates table and checks for new fields since version 1.0 */ protected function _createTable() { global $wpdb; $wpdb->query(' CREATE TABLE IF NOT EXISTS `' . $wpdb->prefix . 'psn_rules` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(80) COLLATE utf8_unicode_ci NOT NULL, `posttype` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `status_before` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `status_after` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `notification_subject` varchar(200) COLLATE utf8_unicode_ci NOT NULL, `notification_body` text COLLATE utf8_unicode_ci NOT NULL, `recipient` varchar(200) COLLATE utf8_unicode_ci NOT NULL, `to` varchar(255) COLLATE utf8_unicode_ci NULL, `to_dyn` text COLLATE utf8_unicode_ci, `cc_select` text COLLATE utf8_unicode_ci, `cc` text COLLATE utf8_unicode_ci, `bcc_select` text COLLATE utf8_unicode_ci, `bcc` text COLLATE utf8_unicode_ci, `active` tinyint(1) NOT NULL DEFAULT "1", `service_email` tinyint(1) NOT NULL DEFAULT "0", `service_log` tinyint(1) NOT NULL DEFAULT "0", `categories` text COLLATE utf8_unicode_ci, `from` varchar(255) COLLATE utf8_unicode_ci NULL, `mail_tpl` int(11) NULL, `editor_restriction` text COLLATE utf8_unicode_ci, `to_loop` tinyint(1) NOT NULL DEFAULT "0", `limit_type` tinyint(1) NULL, `limit_count` int(11) NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT="Plugin: Post Status Notifier"; '); // if the table already existed (eg on update) this will check if all new fields are present $this->_dbPatcher->updateRulesTable(); }
/** * Handles an error, should provide a solution for an unsuccessful test * @param IfwPsn_Wp_Plugin_Manager $pm * @return mixed */ public function handleError(IfwPsn_Wp_Plugin_Manager $pm) { $this->_dbPatcher->createRulesFieldBccSelect(); return __('Trying to create the field...', 'psn'); }
/** * Handles an error, should provide a solution for an unsuccessful test * @param IfwPsn_Wp_Plugin_Manager $pm * @return mixed */ public function handleError(IfwPsn_Wp_Plugin_Manager $pm) { $patcher = new Psn_Patch_Database(); $patcher->createRulesFieldCategories(); return __('Trying to create the field...', 'psn'); }