Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
setuplib.php File Reference

Classes

class  bootstrap_renderer
 This class solves the problem of how to initialise $OUTPUT. More...
 
class  coding_exception
 Exception indicating programming error, must be fixed by a programer. More...
 
class  file_serving_exception
 An exception that indicates that file can not be served. More...
 
class  invalid_dataroot_permissions
 An exception that indicates incorrect permissions in $CFG->dataroot. More...
 
class  invalid_parameter_exception
 Exception indicating malformed parameter problem. More...
 
class  invalid_response_exception
 Exception indicating malformed response problem. More...
 
class  invalid_state_exception
 An exception that indicates something really weird happened. More...
 
class  moodle_exception
 Base Moodle Exception class. More...
 
class  require_login_exception
 Course/activity access exception. More...
 
class  require_login_session_timeout_exception
 Session timeout exception. More...
 
class  required_capability_exception
 Exceptions indicating user does not have permissions to do something and the execution can not continue. More...
 
class  webservice_parameter_exception
 Web service parameter exception class. More...
 

Functions

 abort_all_db_transactions ()
 Unconditionally abort all database transactions, this function should be called from exception handlers only.
 
 check_dir_exists ($dir, $create=true, $recursive=true)
 Function to check if a directory exists and by default create it if not exists.
 
 default_error_handler ($errno, $errstr, $errfile, $errline)
 Default error handler, prevents some white screens.
 
 default_exception_handler ($ex)
 Default exception handler.
 
 during_initial_install ()
 Indicates whether we are in the middle of the initial Moodle install.
 
 format_backtrace ($callers, $plaintext=false)
 Formats a backtrace ready for output.
 
 generate_uuid ()
 
 get_backup_temp_directory ($directory)
 Get the full path of a directory under $CFG->backuptempdir.
 
 get_docs_url ($path=null)
 Returns the Moodle Docs URL in the users language for a given 'More help' link.
 
 get_exception_info ($ex)
 Returns detailed information about specified exception.
 
 get_real_size ($size=0)
 Converts numbers like 10M into bytes.
 
 get_request_storage_directory ($exceptiononerror=true, bool $forcecreate=false)
 Get a per-request storage directory in the tempdir.
 
 hash_local_config_cache ()
 Calculate a proper hash to be able to invalidate stale cached configs.
 
 ini_get_bool ($ini_get_arg)
 This function makes the return value of ini_get consistent if you are setting server directives through the .htaccess file in apache.
 
 init_performance_info ()
 Initializes our performance info early.
 
 initialise_fullme ()
 Initialises $FULLME and friends.
 
 initialise_fullme_cli ()
 Initialises $FULLME and friends for command line scripts.
 
 initialise_local_config_cache ()
 Cache any immutable config locally to avoid constant DB lookups.
 
 is_early_init ($backtrace)
 This function encapsulates the tests for whether an exception was thrown in early init – either during setup.php or during init of $OUTPUT.
 
 is_major_upgrade_required ()
 Check whether a major upgrade is needed.
 
 make_backup_temp_directory ($directory, $exceptiononerror=true)
 Create a directory under $CFG->backuptempdir and make sure it is writable.
 
 make_cache_directory ($directory, $exceptiononerror=true)
 Create a directory under cachedir and make sure it is writable.
 
 make_localcache_directory ($directory, $exceptiononerror=true)
 Create a directory under localcachedir and make sure it is writable.
 
 make_request_directory (bool $exceptiononerror=true, bool $forcecreate=false)
 Create a per-request directory and make sure it is writable.
 
 make_temp_directory ($directory, $exceptiononerror=true)
 Create a directory under tempdir and make sure it is writable.
 
 make_unique_writable_directory ($basedir, $exceptiononerror=true)
 Create a new unique directory within the specified directory.
 
 make_upload_directory ($directory, $exceptiononerror=true)
 Create a directory under dataroot and make sure it is writable.
 
 merge_query_params (array &$target, array $values)
 Merge parsed POST chunks.
 
 proxy_log_callback ($code)
 Add http stream instrumentation.
 
 raise_memory_limit ($newlimit)
 Function to raise the memory limit to a new value.
 
 redirect_if_major_upgrade_required ()
 Redirect to the Notifications page if a major upgrade is required, and terminate the current user session.
 
 reduce_memory_limit ($newlimit)
 Function to reduce the memory limit to a new value.
 
 require_phpunit_isolation ()
 A helper function for deprecated files to use to ensure that, when they are included for unit tests, they are run in an isolated process.
 
 set_access_log_user ()
 Webserver access user logging.
 
 setup_get_remote_url ()
 Get the URL that PHP/the web server thinks it is serving.
 
 setup_validate_php_configuration ()
 This function verifies the sanity of PHP configuration and stops execution if anything critical found.
 
 upgrade_ensure_not_running ($warningonly=false)
 Makes sure that upgrade process is not running.
 
 workaround_max_input_vars ()
 Try to work around the 'max_input_vars' restriction if necessary.
 

Variables

const DEBUG_ALL E_ALL & ~E_STRICT
 All problems except strict PHP warnings.
 
const DEBUG_DEVELOPER E_ALL | E_STRICT
 DEBUG_ALL with all debug messages and strict warnings.
 
const DEBUG_MINIMAL E_ERROR | E_PARSE
 Fatal errors only.
 
const DEBUG_NONE 0
 No warnings and errors at all.
 
const DEBUG_NORMAL E_ERROR | E_PARSE | E_WARNING | E_NOTICE
 Errors, warnings and notices.
 
const MEMORY_EXTRA -3
 Large memory limit for given platform - used in cron, upgrade, and other places that need a lot of memory.
 
const MEMORY_HUGE -4
 Extremely large memory limit - not recommended for standard scripts.
 
const MEMORY_STANDARD -2
 Standard memory limit for given platform.
 
const MEMORY_UNLIMITED -1
 Remove any memory limits.