idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
27,800 | public function string_deprecated ( $ identifier , $ component ) { $ deprecated = $ this -> load_deprecated_strings ( ) ; list ( $ plugintype , $ pluginname ) = core_component :: normalize_component ( $ component ) ; $ normcomponent = $ pluginname ? ( $ plugintype . '_' . $ pluginname ) : $ plugintype ; return isset ( ... | Has string been deprecated? |
27,801 | public function get_list_of_countries ( $ returnall = false , $ lang = null ) { global $ CFG ; if ( $ lang === null ) { $ lang = current_language ( ) ; } $ countries = $ this -> load_component_strings ( 'core_countries' , $ lang ) ; core_collator :: asort ( $ countries ) ; if ( ! $ returnall and ! empty ( $ CFG -> allc... | Returns a localised list of all country names sorted by localised name . |
27,802 | public function translation_exists ( $ lang , $ includeall = true ) { $ translations = $ this -> get_list_of_translations ( $ includeall ) ; return isset ( $ translations [ $ lang ] ) ; } | Checks if the translation exists for the language |
27,803 | public function get_list_of_currencies ( $ lang = null ) { if ( $ lang === null ) { $ lang = current_language ( ) ; } $ currencies = $ this -> load_component_strings ( 'core_currencies' , $ lang ) ; asort ( $ currencies ) ; return $ currencies ; } | Returns localised list of currencies . |
27,804 | public function reset_caches ( $ phpunitreset = false ) { $ this -> cache -> purge ( ) ; $ this -> menucache -> purge ( ) ; if ( ! $ phpunitreset ) { $ langrev = get_config ( 'core' , 'langrev' ) ; $ next = time ( ) ; if ( $ langrev !== false and $ next <= $ langrev and $ langrev - $ next < 60 * 60 ) { $ next = $ langr... | Clears both in - memory and on - disk caches |
27,805 | public function get_revision ( ) { global $ CFG ; if ( empty ( $ CFG -> langstringcache ) ) { return - 1 ; } if ( isset ( $ CFG -> langrev ) ) { return ( int ) $ CFG -> langrev ; } else { return - 1 ; } } | Returns string revision counter this is incremented after any string cache reset . |
27,806 | protected function populate_parent_languages ( $ lang , array $ stack = array ( ) ) { if ( $ lang === 'en' ) { return $ stack ; } if ( in_array ( $ lang , $ stack ) ) { return $ stack ; } if ( ! file_exists ( "$this->otherroot/$lang/langconfig.php" ) ) { return $ stack ; } $ string = array ( ) ; include ( "$this->other... | Helper method that recursively loads all parents of the given language . |
27,807 | public function cidReplace ( $ text , $ callback , $ charset = 'UTF-8' ) { $ dom = ( $ text instanceof Horde_Domhtml ) ? $ text : new Horde_Domhtml ( $ text , $ charset ) ; foreach ( $ dom as $ node ) { if ( $ node instanceof DOMElement ) { switch ( Horde_String :: lower ( $ node -> tagName ) ) { case 'body' : case 'td... | Scan for CID strings in HTML data and replace with data returned from a callback method . |
27,808 | public function definition ( ) { global $ CFG ; $ mform = $ this -> _form ; $ editoroptions = $ this -> _customdata [ 'editoroptions' ] ; $ cohort = $ this -> _customdata [ 'data' ] ; $ mform -> addElement ( 'text' , 'name' , get_string ( 'name' , 'cohort' ) , 'maxlength="254" size="50"' ) ; $ mform -> addRule ( 'name'... | Define the cohort edit form |
27,809 | function set_timeout ( $ timeout ) { if ( ! is_integer ( $ timeout ) ) { if ( is_numeric ( $ timeout ) ) { $ this -> timeout = ( integer ) $ timeout ; return true ; } return false ; } $ this -> timeout = $ timeout ; return true ; } | Allow users to override the default timeout |
27,810 | function add_param ( $ argument , $ type = 'string' ) { $ allowed_types = array ( 'none' , 'empty' , 'base64' , 'boolean' , 'datetime' , 'double' , 'int' , 'i4' , 'string' , 'array' , 'struct' ) ; if ( ! in_array ( $ type , $ allowed_types ) ) { return false ; } if ( $ type != 'datetime' && $ type != 'base64' ) { $ thi... | Add a parameter to the array of parameters . |
27,811 | function permission_to_call ( $ mnet_peer ) { global $ DB , $ CFG , $ USER ; $ system_methods = array ( 'system/listMethods' , 'system/methodSignature' , 'system/methodHelp' , 'system/listServices' ) ; if ( in_array ( $ this -> method , $ system_methods ) ) { return true ; } $ hostids = array ( $ mnet_peer -> id ) ; if... | Check that we are permitted to call method on specified peer |
27,812 | function prepare_http_request ( $ mnet_peer ) { $ this -> uri = $ mnet_peer -> wwwroot . $ mnet_peer -> application -> xmlrpc_server_url ; $ httprequest = curl_init ( $ this -> uri ) ; curl_setopt ( $ httprequest , CURLOPT_TIMEOUT , $ this -> timeout ) ; curl_setopt ( $ httprequest , CURLOPT_RETURNTRANSFER , true ) ; c... | Generate a curl handle and prepare it for sending to an mnet host |
27,813 | public function help ( $ text , \ Mustache_LambdaHelper $ helper ) { $ this -> page -> requires -> js_amd_inline ( $ helper -> render ( $ text ) ) ; } | Add the block of text to the page requires so it is appended in the footer . The content of the block can contain further mustache tags which will be resolved . |
27,814 | public function execute ( ) { global $ OUTPUT , $ PAGE ; $ models = \ core_analytics \ manager :: get_all_models ( true ) ; if ( ! $ models ) { mtrace ( get_string ( 'errornoenabledmodels' , 'tool_analytics' ) ) ; return ; } foreach ( $ models as $ model ) { if ( $ model -> is_static ( ) ) { continue ; } if ( ! $ model... | Executes the prediction task . |
27,815 | public static function get_starred_courses ( $ limit , $ offset ) { global $ USER , $ PAGE ; $ params = self :: validate_parameters ( self :: get_starred_courses_parameters ( ) , [ 'limit' => $ limit , 'offset' => $ offset ] ) ; $ limit = $ params [ 'limit' ] ; $ offset = $ params [ 'offset' ] ; $ usercontext = context... | Get users starred courses . |
27,816 | function reverse ( ) { $ rev = $ this ; $ rev -> edits = array ( ) ; foreach ( $ this -> edits as $ edit ) { $ rev -> edits [ ] = $ edit -> reverse ( ) ; } return $ rev ; } | Compute reversed WikiDiff . |
27,817 | function orig ( ) { $ lines = array ( ) ; foreach ( $ this -> edits as $ edit ) { if ( $ edit -> orig ) array_splice ( $ lines , sizeof ( $ lines ) , 0 , $ edit -> orig ) ; } return $ lines ; } | Get the original set of lines . |
27,818 | function closing ( ) { $ lines = array ( ) ; foreach ( $ this -> edits as $ edit ) { if ( $ edit -> closing ) array_splice ( $ lines , sizeof ( $ lines ) , 0 , $ edit -> closing ) ; } return $ lines ; } | Get the closing set of lines . |
27,819 | function _check ( $ from_lines , $ to_lines ) { if ( serialize ( $ from_lines ) != serialize ( $ this -> orig ( ) ) ) trigger_error ( "Reconstructed original doesn't match" , E_USER_ERROR ) ; if ( serialize ( $ to_lines ) != serialize ( $ this -> closing ( ) ) ) trigger_error ( "Reconstructed closing doesn't match" , E... | Check a WikiDiff for validity . |
27,820 | public static function delete_instance ( $ workshopid ) { global $ DB ; $ dimensions = $ DB -> get_records ( 'workshopform_rubric' , array ( 'workshopid' => $ workshopid ) , '' , 'id' ) ; $ DB -> delete_records_list ( 'workshopform_rubric_levels' , 'dimensionid' , array_keys ( $ dimensions ) ) ; $ DB -> delete_records ... | Delete all data related to a given workshop module instance |
27,821 | protected function load_config ( ) { global $ DB ; if ( ! $ config = $ DB -> get_record ( 'workshopform_rubric_config' , array ( 'workshopid' => $ this -> workshop -> id ) , 'layout' ) ) { $ config = ( object ) array ( 'layout' => 'list' ) ; } return $ config ; } | Get the configuration for the current rubric strategy |
27,822 | protected function get_current_assessment_data ( stdclass $ assessment ) { global $ DB ; if ( empty ( $ this -> dimensions ) ) { return array ( ) ; } list ( $ dimsql , $ dimparams ) = $ DB -> get_in_or_equal ( array_keys ( $ this -> dimensions ) , SQL_PARAMS_NAMED ) ; $ sql = "SELECT dimensionid, wg.* ... | Returns the list of current grades filled by the reviewer indexed by dimensionid |
27,823 | public static function user_enrolment_deleted ( \ core \ event \ user_enrolment_deleted $ event ) { global $ DB ; $ cp = ( object ) $ event -> other [ 'userenrolment' ] ; if ( $ cp -> lastenrol ) { if ( ! $ forums = $ DB -> get_records ( 'forum' , array ( 'course' => $ cp -> courseid ) , '' , 'id' ) ) { return ; } list... | Triggered via user_enrolment_deleted event . |
27,824 | public static function role_assigned ( \ core \ event \ role_assigned $ event ) { global $ CFG , $ DB ; $ context = context :: instance_by_id ( $ event -> contextid , MUST_EXIST ) ; if ( $ context -> contextlevel != CONTEXT_COURSE ) { return ; } require_once ( $ CFG -> dirroot . '/mod/forum/lib.php' ) ; $ userid = $ ev... | Observer for role_assigned event . |
27,825 | public static function course_module_created ( \ core \ event \ course_module_created $ event ) { global $ CFG ; if ( $ event -> other [ 'modulename' ] === 'forum' ) { require_once ( $ CFG -> dirroot . '/mod/forum/lib.php' ) ; $ forum = $ event -> get_record_snapshot ( 'forum' , $ event -> other [ 'instanceid' ] ) ; fo... | Observer for \ core \ event \ course_module_created event . |
27,826 | public static function course_created ( \ core \ event \ course_created $ event ) { global $ CFG ; $ course = $ event -> get_record_snapshot ( 'course' , $ event -> objectid ) ; $ format = course_get_format ( $ course ) ; if ( $ format -> supports_news ( ) && ! empty ( $ course -> newsitems ) ) { require_once ( $ CFG -... | Observer for \ core \ event \ course_created event . |
27,827 | protected function get_iterator ( ) { global $ DB ; $ fieldslist = 't.' . implode ( ', t.' , $ this -> fields ) ; $ sql = "SELECT t.id, $fieldslist FROM {" . $ this -> tablename . "} t JOIN {backup_ids_temp} b ON b.newitemid = t.id WHERE b.backupid = ? ... | Temp storage for unserialized configdata |
27,828 | public function get_custom_user_profile_fields ( ) { global $ DB ; if ( ! is_null ( $ this -> customfields ) ) { return $ this -> customfields ; } $ this -> customfields = array ( ) ; if ( $ proffields = $ DB -> get_records ( 'user_info_field' ) ) { foreach ( $ proffields as $ proffield ) { $ this -> customfields [ ] =... | Return custom user profile fields . |
27,829 | public static function get_identity_providers ( $ authsequence ) { global $ SESSION ; $ identityproviders = [ ] ; foreach ( $ authsequence as $ authname ) { $ authplugin = get_auth_plugin ( $ authname ) ; $ wantsurl = ( isset ( $ SESSION -> wantsurl ) ) ? $ SESSION -> wantsurl : '' ; $ identityproviders = array_merge (... | Return the list of enabled identity providers . |
27,830 | public static function prepare_identity_providers_for_output ( $ identityproviders , renderer_base $ output ) { $ data = [ ] ; foreach ( $ identityproviders as $ idp ) { if ( ! empty ( $ idp [ 'icon' ] ) ) { $ idp [ 'iconurl' ] = $ output -> image_url ( $ idp [ 'icon' ] -> pix , $ idp [ 'icon' ] -> component ) ; } if (... | Prepare a list of identity providers for output . |
27,831 | public function get_password_change_info ( stdClass $ user ) : array { $ site = get_site ( ) ; $ systemcontext = context_system :: instance ( ) ; $ data = new stdClass ( ) ; $ data -> firstname = $ user -> firstname ; $ data -> lastname = $ user -> lastname ; $ data -> username = $ user -> username ; $ data -> sitename... | Returns information on how the specified user can change their password . |
27,832 | public static function migrate_config ( $ config , $ mappings ) { $ ruleconfig = json_decode ( $ config , true ) ; if ( is_array ( $ ruleconfig ) ) { foreach ( $ ruleconfig [ 'competencies' ] as $ key => $ rulecomp ) { $ rulecmpid = $ rulecomp [ 'id' ] ; if ( array_key_exists ( $ rulecmpid , $ mappings ) ) { $ ruleconf... | Migrate rule config when duplicate competency based on mapping competencies ids . |
27,833 | public function getFullMsg ( $ stream = false ) { return $ this -> _msgText ( $ stream , isset ( $ this -> _data [ Horde_Imap_Client :: FETCH_FULLMSG ] ) ? $ this -> _data [ Horde_Imap_Client :: FETCH_FULLMSG ] : null ) ; } | Returns the full message . |
27,834 | public function getStructure ( ) { return isset ( $ this -> _data [ Horde_Imap_Client :: FETCH_STRUCTURE ] ) ? clone $ this -> _data [ Horde_Imap_Client :: FETCH_STRUCTURE ] : new Horde_Mime_Part ( ) ; } | Get the message structure . |
27,835 | public function setHeaders ( $ label , $ data ) { if ( $ data instanceof Horde_Stream ) { $ data = $ data -> stream ; } $ this -> _data [ Horde_Imap_Client :: FETCH_HEADERS ] [ $ label ] = $ data ; } | Set a header entry . |
27,836 | public function setHeaderText ( $ id , $ text ) { $ this -> _data [ Horde_Imap_Client :: FETCH_HEADERTEXT ] [ $ id ] = $ this -> _setMixed ( $ text ) ; } | Set a header text entry . |
27,837 | public function setMimeHeader ( $ id , $ text ) { $ this -> _data [ Horde_Imap_Client :: FETCH_MIMEHEADER ] [ $ id ] = $ this -> _setMixed ( $ text ) ; } | Set a MIME header entry . |
27,838 | public function setBodyPart ( $ id , $ text , $ decode = null ) { $ this -> _data [ Horde_Imap_Client :: FETCH_BODYPART ] [ $ id ] = array ( 'd' => $ decode , 't' => $ this -> _setMixed ( $ text ) ) ; } | Set a body part entry . |
27,839 | public function getBodyPart ( $ id , $ stream = false ) { return $ this -> _msgText ( $ stream , isset ( $ this -> _data [ Horde_Imap_Client :: FETCH_BODYPART ] [ $ id ] ) ? $ this -> _data [ Horde_Imap_Client :: FETCH_BODYPART ] [ $ id ] [ 't' ] : null ) ; } | Get a body part entry . |
27,840 | public function setBodyPartSize ( $ id , $ size ) { $ this -> _data [ Horde_Imap_Client :: FETCH_BODYPARTSIZE ] [ $ id ] = intval ( $ size ) ; } | Set the body part size for a body part . |
27,841 | public function getBodyPartSize ( $ id ) { return isset ( $ this -> _data [ Horde_Imap_Client :: FETCH_BODYPARTSIZE ] [ $ id ] ) ? $ this -> _data [ Horde_Imap_Client :: FETCH_BODYPARTSIZE ] [ $ id ] : null ; } | Returns the body part size if returned by the server . |
27,842 | public function setBodyText ( $ id , $ text ) { $ this -> _data [ Horde_Imap_Client :: FETCH_BODYTEXT ] [ $ id ] = $ this -> _setMixed ( $ text ) ; } | Set a body text entry . |
27,843 | public function getBodyText ( $ id = 0 , $ stream = false ) { return $ this -> _msgText ( $ stream , isset ( $ this -> _data [ Horde_Imap_Client :: FETCH_BODYTEXT ] [ $ id ] ) ? $ this -> _data [ Horde_Imap_Client :: FETCH_BODYTEXT ] [ $ id ] : null ) ; } | Get a body text entry . |
27,844 | public function setEnvelope ( $ data ) { $ this -> _data [ Horde_Imap_Client :: FETCH_ENVELOPE ] = is_array ( $ data ) ? new Horde_Imap_Client_Data_Envelope ( $ data ) : $ data ; } | Set envelope data . |
27,845 | public function getEnvelope ( ) { return isset ( $ this -> _data [ Horde_Imap_Client :: FETCH_ENVELOPE ] ) ? clone $ this -> _data [ Horde_Imap_Client :: FETCH_ENVELOPE ] : new Horde_Imap_Client_Data_Envelope ( ) ; } | Get envelope data . |
27,846 | public function getFlags ( ) { return isset ( $ this -> _data [ Horde_Imap_Client :: FETCH_FLAGS ] ) ? $ this -> _data [ Horde_Imap_Client :: FETCH_FLAGS ] : array ( ) ; } | Get IMAP flags . |
27,847 | public function setImapDate ( $ date ) { $ this -> _data [ Horde_Imap_Client :: FETCH_IMAPDATE ] = is_object ( $ date ) ? $ date : new Horde_Imap_Client_DateTime ( $ date ) ; } | Set IMAP internal date . |
27,848 | public function getImapDate ( ) { return isset ( $ this -> _data [ Horde_Imap_Client :: FETCH_IMAPDATE ] ) ? clone $ this -> _data [ Horde_Imap_Client :: FETCH_IMAPDATE ] : new Horde_Imap_Client_DateTime ( ) ; } | Get internal IMAP date . |
27,849 | public function getSize ( ) { return isset ( $ this -> _data [ Horde_Imap_Client :: FETCH_SIZE ] ) ? $ this -> _data [ Horde_Imap_Client :: FETCH_SIZE ] : 0 ; } | Get message size . |
27,850 | public function getUid ( ) { return isset ( $ this -> _data [ Horde_Imap_Client :: FETCH_UID ] ) ? $ this -> _data [ Horde_Imap_Client :: FETCH_UID ] : null ; } | Get UID . |
27,851 | public function getSeq ( ) { return isset ( $ this -> _data [ Horde_Imap_Client :: FETCH_SEQ ] ) ? $ this -> _data [ Horde_Imap_Client :: FETCH_SEQ ] : null ; } | Get message sequence number . |
27,852 | public function getModSeq ( ) { return isset ( $ this -> _data [ Horde_Imap_Client :: FETCH_MODSEQ ] ) ? $ this -> _data [ Horde_Imap_Client :: FETCH_MODSEQ ] : null ; } | Get the modified sequence value for the message . |
27,853 | public function setDowngraded ( $ downgraded ) { if ( $ downgraded ) { $ this -> _data [ Horde_Imap_Client :: FETCH_DOWNGRADED ] = true ; } else { unset ( $ this -> _data [ Horde_Imap_Client :: FETCH_DOWNGRADED ] ) ; } } | Set the internationalized downgraded status for the message . |
27,854 | public function merge ( Horde_Imap_Client_Data_Fetch $ data ) { $ this -> _data = array_replace_recursive ( $ this -> _data , $ data -> getRawData ( ) ) ; } | Merge a fetch object into this one . |
27,855 | protected function _msgText ( $ stream , $ data ) { if ( $ data instanceof Horde_Stream ) { if ( $ stream ) { $ data -> rewind ( ) ; return $ data -> stream ; } return strval ( $ data ) ; } if ( is_resource ( $ data ) ) { rewind ( $ data ) ; return $ stream ? $ data : stream_get_contents ( $ data ) ; } if ( ! $ stream ... | Return text representation of a field . |
27,856 | protected function _getHeaders ( $ id , $ format , $ key ) { switch ( $ format ) { case self :: HEADER_STREAM : if ( ! isset ( $ this -> _data [ $ key ] [ $ id ] ) ) { $ data = null ; } elseif ( is_object ( $ this -> _data [ $ key ] [ $ id ] ) ) { switch ( $ key ) { case Horde_Imap_Client :: FETCH_HEADERS : $ data = $ ... | Return representation of a header field . |
27,857 | protected function update_init_params ( array & $ params , context $ context , array $ options = null ) { $ rowsnumber = $ this -> count_button_rows ( $ params ) ; if ( $ rowsnumber > 1 ) { $ this -> add_button_before ( $ params , 1 , 'pdw_toggle' , '' ) ; $ params [ 'pdw_toggle_on' ] = 1 ; $ params [ 'pdw_toggle_toolb... | Adds pdw toggle button if there are more than one row of buttons in TinyMCE |
27,858 | public function add_worksheet ( $ name = '' ) { $ ws = new MoodleODSWorksheet ( $ name , $ this -> worksheets ) ; $ this -> worksheets [ ] = $ ws ; return $ ws ; } | Create one Moodle Worksheet . |
27,859 | public function close ( ) { global $ CFG ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; $ writer = new MoodleODSWriter ( $ this -> worksheets ) ; $ contents = $ writer -> get_file_content ( ) ; send_file ( $ contents , $ this -> filename , 0 , 0 , true , true , $ writer -> get_ods_mimetype ( ) ) ; } | Close the Moodle Workbook . |
27,860 | public function write ( $ row , $ col , $ token , $ format = null ) { if ( preg_match ( "/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/" , $ token ) ) { return $ this -> write_number ( $ row , $ col , $ token , $ format ) ; } elseif ( preg_match ( "/^[fh]tt?p:\/\//" , $ token ) ) { return $ this -> write_url ( $ ro... | Write anything somewhere in the worksheet type will be automatically detected . |
27,861 | public function set_align ( $ location ) { if ( in_array ( $ location , array ( 'left' , 'centre' , 'center' , 'right' , 'fill' , 'merge' , 'justify' , 'equal_space' ) ) ) { $ this -> set_h_align ( $ location ) ; } else if ( in_array ( $ location , array ( 'top' , 'vcentre' , 'vcenter' , 'bottom' , 'vjustify' , 'vequal... | Set the cell alignment of the format . |
27,862 | protected function parse_color ( $ color ) { if ( strpos ( $ color , '#' ) === 0 ) { return $ color ; } if ( $ color > 7 and $ color < 53 ) { $ numbers = array ( 8 => 'black' , 12 => 'blue' , 16 => 'brown' , 15 => 'cyan' , 23 => 'gray' , 17 => 'green' , 11 => 'lime' , 14 => 'magenta' , 18 => 'navy' , 53 => 'orange' , 3... | Standardise colour name . |
27,863 | public function get_file_content ( ) { $ dir = make_request_directory ( ) ; $ filename = $ dir . '/result.ods' ; $ files = [ 'mimetype' => [ $ this -> get_ods_mimetype ( ) ] , 'content.xml' => [ $ this -> get_ods_content ( $ this -> worksheets ) ] , 'meta.xml' => [ $ this -> get_ods_meta ( ) ] , 'styles.xml' => [ $ thi... | Fetch the file ocntnet for the ODS . |
27,864 | public static function invalidType ( $ name , $ value , $ expectedType ) { return new static ( sprintf ( 'Expected %s to have type "%s" but found "%s"' , $ name , $ expectedType , is_object ( $ value ) ? get_class ( $ value ) : gettype ( $ value ) ) ) ; } | Thrown when an argument or option has an invalid type . |
27,865 | protected function process_lesson_override ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ oldid = $ data -> id ; $ userinfo = $ this -> get_setting_value ( 'userinfo' ) ; if ( ! $ userinfo && ! is_null ( $ data -> userid ) ) { return ; } $ data -> lessonid = $ this -> get_new_parentid ( 'lesson' ) ; if ( ! i... | Process a lesson override restore |
27,866 | public static function get_driver_instance ( $ type , $ library , $ external = false ) { global $ CFG ; $ classname = $ type . '_' . $ library . '_moodle_database' ; $ libfile = "$CFG->libdir/dml/$classname.php" ; if ( ! file_exists ( $ libfile ) ) { return null ; } require_once ( $ libfile ) ; return new $ classname (... | Loads and returns a database instance with the specified type and library . |
27,867 | public function export_dbconfig ( ) { $ cfg = new stdClass ( ) ; $ cfg -> dbtype = $ this -> get_dbtype ( ) ; $ cfg -> dblibrary = $ this -> get_dblibrary ( ) ; $ cfg -> dbhost = $ this -> dbhost ; $ cfg -> dbname = $ this -> dbname ; $ cfg -> dbuser = $ this -> dbuser ; $ cfg -> dbpass = $ this -> dbpass ; $ cfg -> pr... | Returns the db related part of config . php |
27,868 | protected function store_settings ( $ dbhost , $ dbuser , $ dbpass , $ dbname , $ prefix , array $ dboptions = null ) { $ this -> dbhost = $ dbhost ; $ this -> dbuser = $ dbuser ; $ this -> dbpass = $ dbpass ; $ this -> dbname = $ dbname ; $ this -> prefix = $ prefix ; $ this -> dboptions = ( array ) $ dboptions ; } | Store various database settings |
27,869 | protected function get_settings_hash ( ) { if ( empty ( $ this -> settingshash ) ) { $ this -> settingshash = md5 ( $ this -> dbhost . $ this -> dbuser . $ this -> dbname . $ this -> prefix ) ; } return $ this -> settingshash ; } | Returns a hash for the settings used during connection . |
27,870 | protected function get_metacache ( ) { if ( ! isset ( $ this -> metacache ) ) { $ properties = array ( 'dbfamily' => $ this -> get_dbfamily ( ) , 'settings' => $ this -> get_settings_hash ( ) ) ; $ this -> metacache = cache :: make ( 'core' , 'databasemeta' , $ properties ) ; } return $ this -> metacache ; } | Handle the creation and caching of the databasemeta information for all databases . |
27,871 | protected function get_temp_tables_cache ( ) { if ( ! isset ( $ this -> metacachetemp ) ) { $ properties = array ( 'dbfamily' => $ this -> get_dbfamily ( ) , 'settings' => $ this -> get_settings_hash ( ) ) ; $ this -> metacachetemp = cache :: make ( 'core' , 'temp_tables' , $ properties ) ; } return $ this -> metacache... | Handle the creation and caching of the temporary tables . |
27,872 | public function get_transaction_start_backtrace ( ) { if ( ! $ this -> transactions ) { return null ; } $ lowesttransaction = end ( $ this -> transactions ) ; return $ lowesttransaction -> get_backtrace ( ) ; } | Returns transaction trace for debugging purposes . |
27,873 | protected function query_start ( $ sql , array $ params = null , $ type , $ extrainfo = null ) { if ( $ this -> loggingquery ) { return ; } $ this -> last_sql = $ sql ; $ this -> last_params = $ params ; $ this -> last_type = $ type ; $ this -> last_extrainfo = $ extrainfo ; $ this -> last_time = microtime ( true ) ; s... | This should be called before each db query . |
27,874 | protected function query_end ( $ result ) { if ( $ this -> loggingquery ) { return ; } if ( $ result !== false ) { $ this -> query_log ( ) ; $ this -> last_sql = null ; $ this -> last_params = null ; $ this -> print_debug_time ( ) ; return ; } $ type = $ this -> last_type ; $ sql = $ this -> last_sql ; $ params = $ thi... | This should be called immediately after each db query . It does a clean up of resources . It also throws exceptions if the sql that ran produced errors . |
27,875 | protected function print_debug ( $ sql , array $ params = null , $ obj = null ) { if ( ! $ this -> get_debug ( ) ) { return ; } if ( CLI_SCRIPT ) { $ separator = "--------------------------------\n" ; echo $ separator ; echo "{$sql}\n" ; if ( ! is_null ( $ params ) ) { echo "[" . var_export ( $ params , true ) . "]\n" ... | Prints sql debug info |
27,876 | protected function print_debug_time ( ) { if ( ! $ this -> get_debug ( ) ) { return ; } $ time = $ this -> query_time ( ) ; $ message = "Query took: {$time} seconds.\n" ; if ( CLI_SCRIPT ) { echo $ message ; echo "--------------------------------\n" ; } else if ( AJAX_SCRIPT ) { error_log ( $ message ) ; error_log ( "-... | Prints the time a query took to run . |
27,877 | protected function where_clause ( $ table , array $ conditions = null ) { $ conditions = is_null ( $ conditions ) ? array ( ) : $ conditions ; if ( empty ( $ conditions ) ) { return array ( '' , array ( ) ) ; } if ( debugging ( ) ) { $ columns = $ this -> get_columns ( $ table ) ; if ( empty ( $ columns ) ) { throw new... | Returns the SQL WHERE conditions . |
27,878 | protected function where_clause_list ( $ field , array $ values ) { if ( empty ( $ values ) ) { return array ( "1 = 2" , array ( ) ) ; } $ params = array ( ) ; $ select = "" ; $ values = ( array ) $ values ; foreach ( $ values as $ value ) { if ( is_bool ( $ value ) ) { $ value = ( int ) $ value ; } if ( is_null ( $ va... | Returns SQL WHERE conditions for the ... _list group of methods . |
27,879 | protected function normalise_limit_from_num ( $ limitfrom , $ limitnum ) { global $ CFG ; if ( $ limitfrom === null || $ limitfrom === '' || $ limitfrom === - 1 ) { $ limitfrom = 0 ; } if ( $ limitnum === null || $ limitnum === '' || $ limitnum === - 1 ) { $ limitnum = 0 ; } if ( $ CFG -> debugdeveloper ) { if ( ! is_n... | Ensures that limit params are numeric and positive integers to be passed to the database . We explicitly treat null and - 1 as 0 in order to provide compatibility with how limit values have been passed historically . |
27,880 | public function reset_caches ( $ tablenames = null ) { if ( ! empty ( $ tablenames ) ) { $ dbmetapurged = false ; foreach ( $ tablenames as $ tablename ) { if ( $ this -> temptables -> is_temptable ( $ tablename ) ) { $ this -> get_temp_tables_cache ( ) -> delete ( $ tablename ) ; } else if ( $ dbmetapurged === false )... | Resets the internal column details cache |
27,881 | public function get_manager ( ) { global $ CFG ; if ( ! $ this -> database_manager ) { require_once ( $ CFG -> libdir . '/ddllib.php' ) ; $ classname = $ this -> get_dbfamily ( ) . '_sql_generator' ; require_once ( "$CFG->libdir/ddl/$classname.php" ) ; $ generator = new $ classname ( $ this , $ this -> temptables ) ; $... | Returns the sql generator used for db manipulation . Used mostly in upgrade . php scripts . |
27,882 | public function get_recordset ( $ table , array $ conditions = null , $ sort = '' , $ fields = '*' , $ limitfrom = 0 , $ limitnum = 0 ) { list ( $ select , $ params ) = $ this -> where_clause ( $ table , $ conditions ) ; return $ this -> get_recordset_select ( $ table , $ select , $ params , $ sort , $ fields , $ limit... | Get a number of records as a moodle_recordset where all the given conditions met . |
27,883 | public function get_recordset_list ( $ table , $ field , array $ values , $ sort = '' , $ fields = '*' , $ limitfrom = 0 , $ limitnum = 0 ) { list ( $ select , $ params ) = $ this -> where_clause_list ( $ field , $ values ) ; return $ this -> get_recordset_select ( $ table , $ select , $ params , $ sort , $ fields , $ ... | Get a number of records as a moodle_recordset where one field match one list of values . |
27,884 | public function get_recordset_select ( $ table , $ select , array $ params = null , $ sort = '' , $ fields = '*' , $ limitfrom = 0 , $ limitnum = 0 ) { $ sql = "SELECT $fields FROM {" . $ table . "}" ; if ( $ select ) { $ sql .= " WHERE $select" ; } if ( $ sort ) { $ sql .= " ORDER BY $sort" ; } return $ this -> get_re... | Get a number of records as a moodle_recordset which match a particular WHERE clause . |
27,885 | public function get_records ( $ table , array $ conditions = null , $ sort = '' , $ fields = '*' , $ limitfrom = 0 , $ limitnum = 0 ) { list ( $ select , $ params ) = $ this -> where_clause ( $ table , $ conditions ) ; return $ this -> get_records_select ( $ table , $ select , $ params , $ sort , $ fields , $ limitfrom... | Get a number of records as an array of objects where all the given conditions met . |
27,886 | public function get_records_list ( $ table , $ field , array $ values , $ sort = '' , $ fields = '*' , $ limitfrom = 0 , $ limitnum = 0 ) { list ( $ select , $ params ) = $ this -> where_clause_list ( $ field , $ values ) ; return $ this -> get_records_select ( $ table , $ select , $ params , $ sort , $ fields , $ limi... | Get a number of records as an array of objects where one field match one list of values . |
27,887 | public function get_records_select ( $ table , $ select , array $ params = null , $ sort = '' , $ fields = '*' , $ limitfrom = 0 , $ limitnum = 0 ) { if ( $ select ) { $ select = "WHERE $select" ; } if ( $ sort ) { $ sort = " ORDER BY $sort" ; } return $ this -> get_records_sql ( "SELECT $fields FROM {" . $ table . "} ... | Get a number of records as an array of objects which match a particular WHERE clause . |
27,888 | public function get_records_menu ( $ table , array $ conditions = null , $ sort = '' , $ fields = '*' , $ limitfrom = 0 , $ limitnum = 0 ) { $ menu = array ( ) ; if ( $ records = $ this -> get_records ( $ table , $ conditions , $ sort , $ fields , $ limitfrom , $ limitnum ) ) { foreach ( $ records as $ record ) { $ rec... | Get the first two columns from a number of records as an associative array where all the given conditions met . |
27,889 | public function get_records_select_menu ( $ table , $ select , array $ params = null , $ sort = '' , $ fields = '*' , $ limitfrom = 0 , $ limitnum = 0 ) { $ menu = array ( ) ; if ( $ records = $ this -> get_records_select ( $ table , $ select , $ params , $ sort , $ fields , $ limitfrom , $ limitnum ) ) { foreach ( $ r... | Get the first two columns from a number of records as an associative array which match a particular WHERE clause . |
27,890 | public function get_records_sql_menu ( $ sql , array $ params = null , $ limitfrom = 0 , $ limitnum = 0 ) { $ menu = array ( ) ; if ( $ records = $ this -> get_records_sql ( $ sql , $ params , $ limitfrom , $ limitnum ) ) { foreach ( $ records as $ record ) { $ record = ( array ) $ record ; $ key = array_shift ( $ reco... | Get the first two columns from a number of records as an associative array using a SQL statement . |
27,891 | public function get_record ( $ table , array $ conditions , $ fields = '*' , $ strictness = IGNORE_MISSING ) { list ( $ select , $ params ) = $ this -> where_clause ( $ table , $ conditions ) ; return $ this -> get_record_select ( $ table , $ select , $ params , $ fields , $ strictness ) ; } | Get a single database record as an object where all the given conditions met . |
27,892 | public function get_record_select ( $ table , $ select , array $ params = null , $ fields = '*' , $ strictness = IGNORE_MISSING ) { if ( $ select ) { $ select = "WHERE $select" ; } try { return $ this -> get_record_sql ( "SELECT $fields FROM {" . $ table . "} $select" , $ params , $ strictness ) ; } catch ( dml_missing... | Get a single database record as an object which match a particular WHERE clause . |
27,893 | public function get_field ( $ table , $ return , array $ conditions , $ strictness = IGNORE_MISSING ) { list ( $ select , $ params ) = $ this -> where_clause ( $ table , $ conditions ) ; return $ this -> get_field_select ( $ table , $ return , $ select , $ params , $ strictness ) ; } | Get a single field value from a table record where all the given conditions met . |
27,894 | public function get_field_select ( $ table , $ return , $ select , array $ params = null , $ strictness = IGNORE_MISSING ) { if ( $ select ) { $ select = "WHERE $select" ; } try { return $ this -> get_field_sql ( "SELECT $return FROM {" . $ table . "} $select" , $ params , $ strictness ) ; } catch ( dml_missing_record_... | Get a single field value from a table record which match a particular WHERE clause . |
27,895 | public function get_fieldset_select ( $ table , $ return , $ select , array $ params = null ) { if ( $ select ) { $ select = "WHERE $select" ; } return $ this -> get_fieldset_sql ( "SELECT $return FROM {" . $ table . "} $select" , $ params ) ; } | Selects records and return values of chosen field as an array which match a particular WHERE clause . |
27,896 | public function set_field ( $ table , $ newfield , $ newvalue , array $ conditions = null ) { list ( $ select , $ params ) = $ this -> where_clause ( $ table , $ conditions ) ; return $ this -> set_field_select ( $ table , $ newfield , $ newvalue , $ select , $ params ) ; } | Set a single field in every table record where all the given conditions met . |
27,897 | public function count_records ( $ table , array $ conditions = null ) { list ( $ select , $ params ) = $ this -> where_clause ( $ table , $ conditions ) ; return $ this -> count_records_select ( $ table , $ select , $ params ) ; } | Count the records in a table where all the given conditions met . |
27,898 | public function count_records_select ( $ table , $ select , array $ params = null , $ countitem = "COUNT('x')" ) { if ( $ select ) { $ select = "WHERE $select" ; } return $ this -> count_records_sql ( "SELECT $countitem FROM {" . $ table . "} $select" , $ params ) ; } | Count the records in a table which match a particular WHERE clause . |
27,899 | public function record_exists ( $ table , array $ conditions ) { list ( $ select , $ params ) = $ this -> where_clause ( $ table , $ conditions ) ; return $ this -> record_exists_select ( $ table , $ select , $ params ) ; } | Test whether a record exists in a table where all the given conditions met . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.