コード例 #1
0
ファイル: class.qna.plugin.php プロジェクト: vanilla/addons
 /**
  * Run once on enable.
  */
 public function setup()
 {
     $this->structure();
     touchConfig('QnA.Points.Enabled', false);
     touchConfig('QnA.Points.Answer', 1);
     touchConfig('QnA.Points.AcceptedAnswer', 1);
 }
コード例 #2
0
 /**
  *
  *
  * @throws Exception
  */
 public function structure()
 {
     // Set to false by default, so change in config if uploads allowed.
     touchConfig('Garden.AllowFileUploads', true);
     $Structure = Gdn::structure();
     $Structure->table('Category')->column('AllowFileUploads', 'tinyint(1)', '1')->set();
 }
コード例 #3
0
ファイル: structure.php プロジェクト: vanilla/vanilla
        // Query the next batch of users with IP data needing to be migrated.
        $legacyIPAddresses = $SQL->select(['UserID', 'AllIPAddresses', 'InsertIPAddress', 'LastIPAddress', 'DateLastActive'])->from('User')->where('AllIPAddresses is not null')->limit($limit)->get()->resultArray();
    } while (count($legacyIPAddresses) > 0);
    unset($allIPAddresses, $dateLastActive, $insertIPAddress, $lastIPAddress, $userID, $processedUsers);
}
// Save the current input formatter to the user's config.
// This will allow us to change the default later and grandfather existing forums in.
saveToConfig('Garden.InputFormatter', c('Garden.InputFormatter'));
touchConfig('Garden.Email.Format', 'text');
// Make sure the default locale is in its canonical form.
$currentLocale = c('Garden.Locale');
$canonicalLocale = Gdn_Locale::canonicalize($currentLocale);
if ($currentLocale !== $canonicalLocale) {
    saveToConfig('Garden.Locale', $canonicalLocale);
}
// We need to ensure that recaptcha is enabled if this site is upgrading from
// 2.2 and has never had a captcha plugin
touchConfig('EnabledPlugins.recaptcha', true);
// Move recaptcha private key to plugin namespace.
if (c('Garden.Registration.CaptchaPrivateKey')) {
    touchConfig('Recaptcha.PrivateKey', c('Garden.Registration.CaptchaPrivateKey'));
    removeFromConfig('Garden.Registration.CaptchaPrivateKey');
}
// Move recaptcha public key to plugin namespace.
if (c('Garden.Registration.CaptchaPublicKey')) {
    touchConfig('Recaptcha.PublicKey', c('Garden.Registration.CaptchaPublicKey'));
    removeFromConfig('Garden.Registration.CaptchaPublicKey');
}
// Make sure the smarty folders exist.
touchFolder(PATH_CACHE . '/Smarty/cache');
touchFolder(PATH_CACHE . '/Smarty/compile');
コード例 #4
0
ファイル: structure.php プロジェクト: RodSloan/vanilla
    Gdn::sql()->update('Tag')->set('FullName', 'Name', false, false)->put();
    $Construct->table('Tag')->column('FullName', 'varchar(255)', false, 'index')->set();
}
$Construct->table('Log')->primaryKey('LogID')->column('Operation', array('Delete', 'Edit', 'Spam', 'Moderate', 'Pending', 'Ban', 'Error'), false, 'index')->column('RecordType', array('Discussion', 'Comment', 'User', 'Registration', 'Activity', 'ActivityComment', 'Configuration', 'Group'), false, 'index')->column('TransactionLogID', 'int', null)->column('RecordID', 'int', null, 'index')->column('RecordUserID', 'int', null, 'index')->column('RecordDate', 'datetime')->column('RecordIPAddress', 'ipaddress', null, 'index')->column('InsertUserID', 'int')->column('DateInserted', 'datetime', false, 'index')->column('InsertIPAddress', 'ipaddress', null)->column('OtherUserIDs', 'varchar(255)', null)->column('DateUpdated', 'datetime', null)->column('ParentRecordID', 'int', null, 'index')->column('CategoryID', 'int', null, 'key')->column('Data', 'mediumtext', null)->column('CountGroup', 'int', null)->engine('InnoDB')->set($Explicit, $Drop);
$Construct->table('Regarding')->primaryKey('RegardingID')->column('Type', 'varchar(100)', false, 'key')->column('InsertUserID', 'int', false)->column('DateInserted', 'datetime', false)->column('ForeignType', 'varchar(32)', false)->column('ForeignID', 'int(11)', false)->column('OriginalContent', 'text', true)->column('ParentType', 'varchar(32)', true)->column('ParentID', 'int(11)', true)->column('ForeignURL', 'varchar(255)', true)->column('Comment', 'text', false)->column('Reports', 'int(11)', true)->engine('InnoDB')->set($Explicit, $Drop);
$Construct->table('Ban')->primaryKey('BanID')->column('BanType', array('IPAddress', 'Name', 'Email'), false, 'unique')->column('BanValue', 'varchar(50)', false, 'unique')->column('Notes', 'varchar(255)', null)->column('CountUsers', 'uint', 0)->column('CountBlockedRegistrations', 'uint', 0)->column('InsertUserID', 'int')->column('DateInserted', 'datetime')->column('InsertIPAddress', 'ipaddress', true)->column('UpdateUserID', 'int', true)->column('DateUpdated', 'datetime', true)->column('UpdateIPAddress', 'ipaddress', true)->engine('InnoDB')->set($Explicit, $Drop);
$Construct->table('Spammer')->column('UserID', 'int', false, 'primary')->column('CountSpam', 'usmallint', 0)->column('CountDeletedSpam', 'usmallint', 0)->set($Explicit, $Drop);
$Construct->table('Media')->primaryKey('MediaID')->column('Name', 'varchar(255)')->column('Path', 'varchar(255)')->column('Type', 'varchar(128)')->column('Size', 'int(11)')->column('InsertUserID', 'int(11)')->column('DateInserted', 'datetime')->column('ForeignID', 'int(11)', true, 'index.Foreign')->column('ForeignTable', 'varchar(24)', true, 'index.Foreign')->column('ImageWidth', 'usmallint', null)->column('ImageHeight', 'usmallint', null)->column('ThumbWidth', 'usmallint', null)->column('ThumbHeight', 'usmallint', null)->column('ThumbPath', 'varchar(255)', null)->set(false, false);
// Merge backup.
$Construct->table('UserMerge')->primaryKey('MergeID')->column('OldUserID', 'int', false, 'key')->column('NewUserID', 'int', false, 'key')->column('DateInserted', 'datetime')->column('InsertUserID', 'int')->column('DateUpdated', 'datetime', true)->column('UpdateUserID', 'int', true)->column('Attributes', 'text', true)->set();
$Construct->table('UserMergeItem')->column('MergeID', 'int', false, 'key')->column('Table', 'varchar(30)')->column('Column', 'varchar(30)')->column('RecordID', 'int')->column('OldUserID', 'int')->column('NewUserID', 'int')->set();
$Construct->table('Attachment')->primaryKey('AttachmentID')->column('Type', 'varchar(64)')->column('ForeignID', 'varchar(50)', false, 'index')->column('ForeignUserID', 'int', false, 'key')->column('Source', 'varchar(64)')->column('SourceID', 'varchar(32)')->column('SourceURL', 'varchar(255)')->column('Attributes', 'text', true)->column('DateInserted', 'datetime')->column('InsertUserID', 'int', false, 'key')->column('InsertIPAddress', 'ipaddress')->column('DateUpdated', 'datetime', true)->column('UpdateUserID', 'int', true)->column('UpdateIPAddress', 'ipaddress', true)->set($Explicit, $Drop);
// Save the current input formatter to the user's config.
// This will allow us to change the default later and grandfather existing forums in.
saveToConfig('Garden.InputFormatter', c('Garden.InputFormatter'));
touchConfig('Garden.Email.Format', 'text');
// Make sure the default locale is in its canonical form.
$currentLocale = c('Garden.Locale');
$canonicalLocale = Gdn_Locale::canonicalize($currentLocale);
if ($currentLocale !== $canonicalLocale) {
    saveToConfig('Garden.Locale', $canonicalLocale);
}
// We need to undo cleditor's bad behavior for our reformed users.
// If you still need to manipulate this, do it in memory instead (SAVE = false).
if (!c('Garden.Html.SafeStyles')) {
    removeFromConfig('Garden.Html.SafeStyles');
}
// Make sure the smarty folders exist.
if (!file_exists(PATH_CACHE . '/Smarty')) {
    @mkdir(PATH_CACHE . '/Smarty');
}
コード例 #5
0
 /**
  * Perform any necessary database or configuration updates.
  */
 public function structure()
 {
     touchConfig('Plugins.Vanillicon.Type', 'v2');
 }