Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/setuplib.php File Reference

Go to the source code of this file.

Data Structures

class  object
class  moodle_exception
class  require_login_exception
class  webservice_parameter_exception
class  required_capability_exception
class  coding_exception
class  invalid_parameter_exception
class  invalid_response_exception
class  invalid_state_exception
class  invalid_dataroot_permissions
class  file_serving_exception
class  bootstrap_renderer

Namespaces

namespace  core

Enumerations

enum  DEBUG_NONE
 Debug levels ///. More...
enum  DEBUG_MINIMAL
enum  DEBUG_NORMAL
enum  DEBUG_ALL
enum  DEBUG_DEVELOPER
enum  MEMORY_UNLIMITED
enum  MEMORY_STANDARD
enum  MEMORY_EXTRA
enum  MEMORY_HUGE
enum  MATURITY_ALPHA
enum  MATURITY_BETA
enum  MATURITY_RC
enum  MATURITY_STABLE
enum  ANY_VERSION

Functions

 default_exception_handler ($ex)
 default_error_handler ($errno, $errstr, $errfile, $errline, $errcontext)
 abort_all_db_transactions ()
 is_early_init ($backtrace)
 print_error ($errorcode, $module= 'error', $link= '', $a=null, $debuginfo=null)
 get_exception_info ($ex)
 get_docs_url ($path=null)
 format_backtrace ($callers, $plaintext=false)
 ini_get_bool ($ini_get_arg)
 setup_validate_php_configuration ()
 initialise_cfg ()
 initialise_fullme ()
 initialise_fullme_cli ()
 setup_get_remote_url ()
 init_performance_info ()
 during_initial_install ()
 raise_memory_limit ($newlimit)
 reduce_memory_limit ($newlimit)
 get_real_size ($size=0)
 redirect_if_major_upgrade_required ()
 check_dir_exists ($dir, $create=true, $recursive=true)
 make_upload_directory ($directory, $exceptiononerror=true)
 make_temp_directory ($directory, $exceptiononerror=true)
 make_cache_directory ($directory, $exceptiononerror=true)
 init_memcached ()
 init_eaccelerator ()
 is_web_crawler ()

Enumeration Type Documentation

Special value that can be used in $plugin->dependencies in version.php files.

Definition at line 67 of file setuplib.php.

enum DEBUG_ALL

E_ALL without E_STRICT for now, do show recoverable fatal errors

Definition at line 40 of file setuplib.php.

DEBUG_ALL with extra Moodle debug messages - (DEBUG_ALL | 32768)

Definition at line 42 of file setuplib.php.

E_ERROR | E_PARSE

Definition at line 36 of file setuplib.php.

enum DEBUG_NONE

Debug levels ///.

no warnings at all

Definition at line 34 of file setuplib.php.

E_ERROR | E_PARSE | E_WARNING | E_NOTICE

Definition at line 38 of file setuplib.php.

Software maturity levels used by the core and plugins

Definition at line 59 of file setuplib.php.

Definition at line 60 of file setuplib.php.

Definition at line 61 of file setuplib.php.

Definition at line 62 of file setuplib.php.

Large memory limit for given platform - used in cron, upgrade, and other places that need a lot of memory. Can be overridden with $CFG->extramemorylimit setting.

Definition at line 52 of file setuplib.php.

Extremely large memory limit - not recommended for standard scripts

Definition at line 54 of file setuplib.php.

Standard memory limit for given platform

Definition at line 47 of file setuplib.php.

Remove any memory limits

Definition at line 45 of file setuplib.php.


Function Documentation

Unconditionally abort all database transactions, this function should be called from exception handlers only.

Returns:
void

Definition at line 375 of file setuplib.php.

Here is the caller graph for this function:

check_dir_exists ( dir,
create = true,
recursive = true 
)

Function to check if a directory exists and by default create it if not exists.

Previously this was accepting paths only from dataroot, but we now allow files outside of dataroot if you supply custom paths for some settings in config.php. This function does not verify that the directory is writable.

NOTE: this function uses current file stat cache, please use clearstatcache() before this if you expect that the directories may have been removed recently from a different request.

Parameters:
string$dirabsolute directory path
boolean$createdirectory if does not exist
boolean$recursivecreate directory recursively
Returns:
boolean true if directory exists or created, false otherwise

Definition at line 1089 of file setuplib.php.

Here is the caller graph for this function:

default_error_handler ( errno,
errstr,
errfile,
errline,
errcontext 
)

Default error handler, prevents some white screens.

Parameters:
int$errno
string$errstr
string$errfile
int$errline
array$errcontext
Returns:
bool false means use default error handler

Definition at line 362 of file setuplib.php.

Default exception handler, uncaught exceptions are equivalent to error() in 1.9 and earlier

Parameters:
Exception$ex
Returns:
void -does not return. Terminates execution!

Definition at line 308 of file setuplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Indicates whether we are in the middle of the initial Moodle install.

Very occasionally it is necessary avoid running certain bits of code before the Moodle installation has completed. The installed flag is set in admin/index.php after Moodle core and all the plugins have been installed, but just before the person doing the initial install is asked to choose the admin password.

Returns:
boolean true if the initial install is not complete.

Definition at line 875 of file setuplib.php.

Here is the caller graph for this function:

format_backtrace ( callers,
plaintext = false 
)

Formats a backtrace ready for output.

Parameters:
array$callersbacktrace array, as returned by debug_backtrace().
boolean$plaintextif false, generates HTML, if true generates plain text.
Returns:
string formatted backtrace, ready for output.

Definition at line 570 of file setuplib.php.

Here is the caller graph for this function:

get_docs_url ( path = null)

Returns the Moodle Docs URL in the users language

object

Parameters:
string$paththe end of the URL.
Returns:
string The MoodleDocs URL in the user's language. for example http://docs.moodle.org/en/$path

Definition at line 535 of file setuplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_exception_info ( ex)

Returns detailed information about specified exception.

Parameters:
exception$ex
Returns:
object

Definition at line 443 of file setuplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_real_size ( size = 0)

Converts numbers like 10M into bytes.

Parameters:
string$sizeThe size to be converted
Returns:
int

Definition at line 993 of file setuplib.php.

Here is the caller graph for this function:

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.

Current behavior for value set from php.ini On = 1, Off = [blank] Current behavior for value set from .htaccess On = On, Off = Off Contributed by jdell @ unr.edu

Parameters:
string$ini_get_argThe argument to get
Returns:
bool True for on false for not

Definition at line 615 of file setuplib.php.

Here is the caller graph for this function:

Definition at line 1236 of file setuplib.php.

Definition at line 1224 of file setuplib.php.

Initializes our performance info early.

Pairs up with get_performance_info() which is actually in moodlelib.php. This function is here so that we can call it before all the libs are pulled in.

$PERF

Definition at line 848 of file setuplib.php.

Initialise global $CFG variable

Returns:
void

Definition at line 646 of file setuplib.php.

Initialises $FULLME and friends. Private function. Should only be called from setup.php.

Definition at line 669 of file setuplib.php.

Here is the call graph for this function:

Initialises $FULLME and friends for command line scripts. This is a private method for use by initialise_fullme.

Definition at line 745 of file setuplib.php.

Here is the caller graph for this function:

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.

If another exception is thrown then, and if we do not take special measures, we would just get a very cryptic message "Exception thrown without a stack frame in Unknown on line 0". That makes debugging very hard, so we do take special measures in default_exception_handler, with the help of this function.

Parameters:
array$backtracethe stack trace to analyse.
Returns:
boolean whether the stack trace is somewhere in output initialisation.

Definition at line 399 of file setuplib.php.

Here is the caller graph for this function:

Checks if current user is a web crawler.

This list can not be made complete, this is not a security restriction, we make the list only to help these sites especially when automatic guest login is disabled.

If admin needs security they should enable forcelogin and disable guest access!!

Returns:
bool

Definition at line 1260 of file setuplib.php.

Here is the caller graph for this function:

make_cache_directory ( directory,
exceptiononerror = true 
)

Create a directory under cachedir and make sure it is writable.

Parameters:
string$directorythe full path of the directory to be created under $CFG->cachedir
bool$exceptiononerrorthrow exception if error encountered
Returns:
string|false Returns full path to directory if successful, false if not; may throw exception

Definition at line 1212 of file setuplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

make_temp_directory ( directory,
exceptiononerror = true 
)

Create a directory under tempdir and make sure it is writable. Temporary files should be used during the current request only!

Parameters:
string$directorythe full path of the directory to be created under $CFG->tempdir
bool$exceptiononerrorthrow exception if error encountered
Returns:
string|false Returns full path to directory if successful, false if not; may throw exception

Definition at line 1194 of file setuplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

make_upload_directory ( directory,
exceptiononerror = true 
)

Create a directory under dataroot and make sure it is writable. Do not use for temporary and cache files - see make_temp_directory() and make_cache_directory().

Parameters:
string$directorythe full path of the directory to be created under $CFG->dataroot
bool$exceptiononerrorthrow exception if error encountered
Returns:
string|false Returns full path to directory if successful, false if not; may throw exception

Definition at line 1172 of file setuplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

print_error ( errorcode,
module = 'error',
link = '',
a = null,
debuginfo = null 
)

Abort execution by throwing of a general exception, default exception handler displays the error message in most cases.

Parameters:
string$errorcodeThe name of the language string containing the error message. Normally this should be in the error.php lang file.
string$moduleThe language file to get the error message from.
string$linkThe url where the user will be prompted to continue. If no url is provided the user will be directed to the site index page.
object$aExtra words and phrases that might be required in the error string
string$debuginfooptional debugging information
Returns:
void, always throws exception!

Definition at line 434 of file setuplib.php.

raise_memory_limit ( newlimit)

Function to raise the memory limit to a new value. Will respect the memory limit if it is higher, thus allowing settings in php.ini, apache conf or command line switches to override it.

The memory limit should be expressed with a constant MEMORY_STANDARD, MEMORY_EXTRA or MEMORY_HUGE. It is possible to use strings or integers too (eg:'128M').

Parameters:
mixed$newlimitthe new memory limit
Returns:
bool success

Definition at line 893 of file setuplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Check whether a major upgrade is needed. That is defined as an upgrade that changes something really fundamental in the database, so nothing can possibly work until the database has been updated, and that is defined by the hard-coded version number in this function.

Definition at line 1055 of file setuplib.php.

Here is the call graph for this function:

reduce_memory_limit ( newlimit)

Function to reduce the memory limit to a new value. Will respect the memory limit if it is lower, thus allowing settings in php.ini, apache conf or command line switches to override it

The memory limit should be expressed with a string (eg:'64M')

Parameters:
string$newlimitthe new memory limit
Returns:
bool

Definition at line 962 of file setuplib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Get the URL that PHP/the web server thinks it is serving. Private function used by initialise_fullme. In your code, use $PAGE->url, $SCRIPT, etc.

Returns:
array in the same format that parse_url returns, with the addition of a 'fullpath' element, which includes any slasharguments path.

Definition at line 771 of file setuplib.php.

Here is the caller graph for this function:

This function verifies the sanity of PHP configuration and stops execution if anything critical found.

Definition at line 628 of file setuplib.php.

Here is the call graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations