当前位置: 首页>>代码示例>>PHP>>正文


PHP set_config_plugin函数代码示例

本文整理汇总了PHP中set_config_plugin函数的典型用法代码示例。如果您正苦于以下问题:PHP set_config_plugin函数的具体用法?PHP set_config_plugin怎么用?PHP set_config_plugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了set_config_plugin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: xmldb_artefact_comment_upgrade

function xmldb_artefact_comment_upgrade($oldversion = 0)
{
    $success = true;
    if ($oldversion < 2011011201) {
        $table = new XMLDBTable('artefact_comment_comment');
        $field = new XMLDBField('rating');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED);
        $success = $success && add_field($table, $field);
    }
    if ($oldversion < 2013072400) {
        $table = new XMLDBTable('artefact_comment_comment');
        $field = new XMLDBField('lastcontentupdate');
        $field->setAttributes(XMLDB_TYPE_DATETIME);
        $success = $success && add_field($table, $field);
        $success = $success && execute_sql('update {artefact_comment_comment} acc
            set lastcontentupdate = (
                select a.mtime
                from {artefact} a
                where a.id = acc.artefact
            )');
    }
    if ($oldversion < 2015081000) {
        // Set default maxindent for threaded comments
        set_config_plugin('artefact', 'comment', 'maxindent', 5);
    }
    return $success;
}
开发者ID:rboyatt,项目名称:mahara,代码行数:27,代码来源:upgrade.php

示例2: xmldb_blocktype_wall_upgrade

function xmldb_blocktype_wall_upgrade($oldversion = 0)
{
    if ($oldversion < 2009021801) {
        set_config_plugin('blocktype', 'wall', 'defaultpostsizelimit', 1500);
        // 1500 characters
    }
    return true;
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:8,代码来源:upgrade.php

示例3: postinst

 public static function postinst($prevversion)
 {
     if ($prevversion == 0) {
         set_config_plugin('artefact', 'comment', 'commenteditabletime', 10);
         foreach (ArtefactTypeComment::deleted_types() as $type) {
             insert_record('artefact_comment_deletedby', (object) array('name' => $type));
         }
     }
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:9,代码来源:lib.php

示例4: postinst

 public static function postinst($prevversion)
 {
     if ($prevversion == 0) {
         set_config_plugin('blocktype', 'wall', 'defaultpostsizelimit', 1500);
         // 1500 characters
     }
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:7,代码来源:lib.php

示例5: cron

 public static function cron()
 {
     // Only run the cron if this plugin is the active search plugin
     if (get_config('searchplugin') !== 'elasticsearch') {
         return;
     }
     // store the last time the function was executed: eg: 2013-04-11 16:45:30
     $timestamp = date('Y-m-d H:i:s');
     $last_run = get_config_plugin('search', 'elasticsearch', 'lastrun');
     if (isset($last_run)) {
         ElasticsearchIndexing::add_to_queue_access($last_run, $timestamp);
     }
     set_config_plugin('search', 'elasticsearch', 'lastrun', $timestamp);
     // process the queue
     self::index_queued_items();
 }
开发者ID:vohung96,项目名称:mahara,代码行数:16,代码来源:lib.php

示例6: save_config_options

 public static function save_config_options($values)
 {
     if (substr($values['solrurl'], -1) != '/') {
         $values['solrurl'] .= '/';
     }
     set_config_plugin('search', 'solr', 'solrurl', $values['solrurl']);
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:7,代码来源:lib.php

示例7: save_config_options

 public static function save_config_options($form, $values)
 {
     $enabledtypes = array();
     foreach ($values as $type => $enabled) {
         if (!in_array($type, self::get_all_filetypes())) {
             continue;
         }
         if (!empty($enabled)) {
             $enabledtypes[] = $type;
         }
     }
     set_config_plugin('blocktype', 'internalmedia', 'enabledtypes', serialize($enabledtypes));
     set_config_plugin('blocktype', 'internalmedia', 'height', $values['height']);
     set_config_plugin('blocktype', 'internalmedia', 'width', $values['width']);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:15,代码来源:lib.php

示例8: xmldb_core_upgrade


//.........这里部分代码省略.........
                        $i->set('description', get_string('skype', 'artefact.internal'));
                        break;
                    case 'yahoochat':
                        $i->set('note', 'yahoo');
                        $i->set('description', get_string('yahoo', 'artefact.internal'));
                        break;
                }
                $i->set('title', $result->title);
                $i->commit();
                $count++;
                if ($count % $limit == 0 || $count == $total) {
                    log_debug("{$count}/{$total}");
                    set_time_limit(30);
                }
            }
        }
        $sql = "SELECT value FROM {search_config} WHERE plugin='elasticsearch' AND field='artefacttypesmap'";
        if ($result = get_field_sql($sql, array())) {
            log_debug('Clean up elasticsearch fields for the old messaging fields');
            $artefacttypesmap_array = explode("\n", $result);
            $elasticsearchartefacttypesmap = array();
            foreach ($artefacttypesmap_array as $key => $value) {
                $tmpkey = explode("|", $value);
                if (count($tmpkey) == 3) {
                    if (!in_array($tmpkey[0], $oldmessagingfieldsarray)) {
                        // we're going to keep this one.
                        $elasticsearchartefacttypesmap[] = $value;
                    }
                }
            }
            // add socialprofile field.
            $elasticsearchartefacttypesmap[] = "socialprofile|Profile|Text";
            // now save the data excluding the old messaging fields.
            set_config_plugin('search', 'elasticsearch', 'artefacttypesmap', implode("\n", $elasticsearchartefacttypesmap));
        }
        log_debug('Delete unused, but still installed artefact types');
        delete_records_select("artefact_installed_type", "name IN (" . $oldmessagingfields . ")");
        log_debug('Install the social profile blocktype so users can see their migrated data');
        if ($data = check_upgrades('blocktype.internal/socialprofile')) {
            upgrade_plugin($data);
        }
    }
    if ($oldversion < 2014092300) {
        log_debug("Install 'multirecipientnotification' plugin");
        if ($data = check_upgrades('module.multirecipientnotification')) {
            upgrade_plugin($data);
        }
    }
    if ($oldversion < 2014101300) {
        log_debug("Make sure default notifications are not set to 'none'");
        // Make sure the 'system messages' and 'messages from other users' have a notification method set
        // It was possible after earlier upgrades to set method to 'none'.
        // Also make sure old defaultmethod is respected.
        $activitytypes = get_records_assoc('activity_type');
        foreach ($activitytypes as $type) {
            $type->defaultmethod = get_config('defaultnotificationmethod') ? get_config('defaultnotificationmethod') : 'email';
            if ($type->name == 'maharamessage' || $type->name == 'usermessage') {
                $type->allownonemethod = 0;
            }
            update_record('activity_type', $type);
        }
        // Make sure users have their 'system messages' and 'messages from other users' notification method set
        if ($useractivities = get_records_sql_assoc("SELECT * FROM {activity_type} at, {usr_activity_preference} uap\n                                                     WHERE at.id = uap.activity\n                                                     AND at.name IN ('maharamessage', 'usermessage')\n                                                     AND (method IS NULL OR method = '')", array())) {
            foreach ($useractivities as $activity) {
                $userprefs = new stdClass();
                $userprefs->method = $activity->defaultmethod;
开发者ID:patkira,项目名称:mahara,代码行数:67,代码来源:upgrade.php

示例9: save_config_options

 public static function save_config_options($values, $form)
 {
     $configs = array('simplesamlphplib', 'simplesamlphpconfig');
     if (isset($values['authglobalconfig'])) {
         foreach ($configs as $config) {
             set_config_plugin('auth', 'saml', $config, $values[$config]);
         }
     } else {
         $authinstance = new stdClass();
         if ($values['instance'] > 0) {
             $values['create'] = false;
             $current = get_records_assoc('auth_instance_config', 'instance', $values['instance'], '', 'field, value');
             $authinstance->id = $values['instance'];
         } else {
             $values['create'] = true;
             $lastinstance = get_records_array('auth_instance', 'institution', $values['institution'], 'priority DESC', '*', '0', '1');
             if ($lastinstance == false) {
                 $authinstance->priority = 0;
             } else {
                 $authinstance->priority = $lastinstance[0]->priority + 1;
             }
         }
         $authinstance->institution = $values['institution'];
         $authinstance->authname = $values['authname'];
         $authinstance->instancename = $values['authname'];
         if ($values['create']) {
             $values['instance'] = insert_record('auth_instance', $authinstance, 'id', true);
         } else {
             update_record('auth_instance', $authinstance, array('id' => $values['instance']));
         }
         if (empty($current)) {
             $current = array();
         }
         self::$default_config = array('user_attribute' => $values['user_attribute'], 'weautocreateusers' => $values['weautocreateusers'], 'remoteuser' => $values['remoteuser'], 'firstnamefield' => $values['firstnamefield'], 'surnamefield' => $values['surnamefield'], 'emailfield' => $values['emailfield'], 'updateuserinfoonlogin' => $values['updateuserinfoonlogin'], 'institutionattribute' => $values['institutionattribute'], 'institutionvalue' => $values['institutionvalue'], 'institutionregex' => $values['institutionregex']);
         foreach (self::$default_config as $field => $value) {
             $record = new stdClass();
             $record->instance = $values['instance'];
             $record->field = $field;
             $record->value = $value;
             if ($values['create'] || !array_key_exists($field, $current)) {
                 insert_record('auth_instance_config', $record);
             } else {
                 update_record('auth_instance_config', $record, array('instance' => $values['instance'], 'field' => $field));
             }
         }
     }
     foreach ($configs as $config) {
         self::$default_config[$config] = get_config_plugin('auth', 'saml', $config);
     }
     return $values;
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:51,代码来源:lib.php

示例10: save_config_options

 public static function save_config_options($form, $values)
 {
     foreach (array('commentratings') as $settingname) {
         set_config_plugin('artefact', 'comment', $settingname, $values[$settingname]);
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:6,代码来源:lib.php

示例11: postinst

 /**
  * Called post install and after every upgrade to the artefact.
  * @param string $prevversion the previously installed version of this artefact.
  */
 public static function postinst($prevversion)
 {
     if ($prevversion == 0) {
         // Since this is the first time, we need to
         // create the default settings and the static
         // table data for aretfact_annotation_deletedby.
         set_config_plugin('artefact', 'annotation', 'commenteditabletime', 10);
         foreach (ArtefactTypeAnnotationfeedback::deleted_by_types() as $index => $type) {
             insert_record('artefact_annotation_deletedby', (object) array('id' => (int) $index + 1, 'name' => $type));
         }
         // If elasticsearch is installed, update the artefacttypesmap field to include
         // annotation and annotationfeedback.
         $sql = "SELECT value FROM {search_config} WHERE plugin='elasticsearch' AND field='artefacttypesmap'";
         if ($result = get_field_sql($sql, array())) {
             $elasticsearchartefacttypesmap = explode("\n", $result);
             // add annotation and annotationfeedback fields.
             $elasticsearchartefacttypesmap[] = "annotation|Annotation|Text";
             $elasticsearchartefacttypesmap[] = "annotationfeedback|Annotation|Text";
             // Now save the data including the new annotation fields.
             set_config_plugin('search', 'elasticsearch', 'artefacttypesmap', implode("\n", $elasticsearchartefacttypesmap));
         }
         // Now install the blocktype annotation only if Mahara was previously installed.
         // Otherwise, the Mahara installer will install everything.
         if (get_config('installed')) {
             if ($upgrade = check_upgrades('blocktype.annotation/annotation')) {
                 upgrade_plugin($upgrade);
             }
         }
     }
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:34,代码来源:lib.php

示例12: save_config_options

 public function save_config_options($values)
 {
     $mandatory = '';
     $public = '';
     foreach ($values as $field => $value) {
         if (($value == 'on' || $value == 'checked') && preg_match('/([a-zA-Z]+)_(mandatory|public)/', $field, $matches)) {
             if (empty(${$matches}[2])) {
                 ${$matches}[2] = $matches[1];
             } else {
                 ${$matches}[2] .= ',' . $matches[1];
             }
         }
     }
     set_config_plugin('artefact', 'internal', 'profilepublic', $public);
     set_config_plugin('artefact', 'internal', 'profilemandatory', $mandatory);
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:16,代码来源:lib.php

示例13: postinst

 public static function postinst($prevversion)
 {
     if ($prevversion == 0) {
         set_config_plugin('blocktype', 'gallery', 'useslimbox2', 1);
         // Use Slimbox 2 by default
         set_config_plugin('blocktype', 'gallery', 'photoframe', 1);
         // Show frame around photos
         set_config_plugin('blocktype', 'gallery', 'previewwidth', 1024);
         // Maximum photo width for slimbox2 preview
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:11,代码来源:lib.php

示例14: postinst

 public static function postinst($prevversion)
 {
     if ($prevversion == 0) {
         set_config_plugin('search', 'internal', 'exactusersearch', 1);
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:6,代码来源:lib.php

示例15: xmldb_artefact_comment_upgrade

function xmldb_artefact_comment_upgrade($oldversion = 0)
{
    $success = true;
    if ($oldversion < 2011011201) {
        $table = new XMLDBTable('artefact_comment_comment');
        $field = new XMLDBField('rating');
        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED);
        $success = $success && add_field($table, $field);
    }
    if ($oldversion < 2013072400) {
        $table = new XMLDBTable('artefact_comment_comment');
        $field = new XMLDBField('lastcontentupdate');
        $field->setAttributes(XMLDB_TYPE_DATETIME);
        $success = $success && add_field($table, $field);
        $success = $success && execute_sql('update {artefact_comment_comment} acc
            set lastcontentupdate = (
                select a.mtime
                from {artefact} a
                where a.id = acc.artefact
            )');
    }
    if ($oldversion < 2015081000) {
        // Set default maxindent for threaded comments
        set_config_plugin('artefact', 'comment', 'maxindent', 5);
    }
    if ($oldversion < 2015100100) {
        // Add new column '' to table artefact_comment_comment used for diplaying comments by threads
        $table = new XMLDBTable('artefact_comment_comment');
        $field = new XMLDBField('threadedposition');
        $field->setAttributes(XMLDB_TYPE_INTEGER, 4, null, null);
        if (!field_exists($table, $field)) {
            log_debug('Updating position for threaded comments');
            add_field($table, $field);
            $index = new XMLDBIndex('threadedpositionix');
            $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('threadedposition'));
            add_index($table, $index);
            // Update the threaded position for all exising comments
            // We assume there is no child comment in the database before this release
            // Comments on views
            $commented_views = get_column_sql('
                SELECT DISTINCT onview
                FROM {artefact_comment_comment}
                WHERE onview IS NOT NULL
                ORDER BY onview
            ');
            if ($commented_views) {
                $total = count($commented_views);
                $limit = 5000;
                $done = 0;
                foreach ($commented_views as $v) {
                    $comments = get_records_sql_array('
                        SELECT artefact
                        FROM {artefact_comment_comment}
                        WHERE onview = ?
                        ORDER BY artefact
                        ', array($v));
                    $p = 1;
                    foreach ($comments as $c) {
                        update_record('artefact_comment_comment', (object) array('threadedposition' => $p), array('artefact' => $c->artefact));
                        $p++;
                    }
                    $done++;
                    if ($done % $limit == 0 || $done >= $total) {
                        log_debug("Updating comments on views: {$done}/{$total}");
                        set_time_limit(30);
                    }
                }
            }
            // Comments on artefact
            $commented_views = get_column_sql('
                SELECT DISTINCT onartefact
                FROM {artefact_comment_comment}
                WHERE onartefact IS NOT NULL
                ORDER BY onartefact
            ');
            if ($commented_views) {
                $total = count($commented_views);
                $limit = 5000;
                $done = 0;
                foreach ($commented_views as $v) {
                    $comments = get_records_sql_array('
                        SELECT artefact
                        FROM {artefact_comment_comment}
                        WHERE onartefact = ?
                        ORDER BY artefact
                        ', array($v));
                    $p = 1;
                    foreach ($comments as $c) {
                        update_record('artefact_comment_comment', (object) array('threadedposition' => $p), array('artefact' => $c->artefact));
                        $p++;
                    }
                    $done++;
                    if ($done % $limit == 0 || $done >= $total) {
                        log_debug("Updating comments on artefacts: {$done}/{$total}");
                        set_time_limit(30);
                    }
                }
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:sarahjcotton,项目名称:mahara,代码行数:101,代码来源:upgrade.php


注:本文中的set_config_plugin函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。