[ Index ]

PHP Cross Reference of YOURLS

title

Body

[close]

/includes/Database/ -> YDB.php (summary)

Aura SQL wrapper for YOURLS that creates the allmighty YDB object.

File Size: 425 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

YDB:: (30 methods):
  __construct()
  init()
  set_emulate_state()
  get_emulate_state()
  connect_to_DB()
  dead_or_error()
  start_profiler()
  set_html_context()
  get_html_context()
  set_option()
  has_option()
  get_option()
  delete_option()
  set_infos()
  has_infos()
  get_infos()
  delete_infos()
  get_plugins()
  set_plugins()
  add_plugin()
  remove_plugin()
  get_plugin_pages()
  set_plugin_pages()
  add_plugin_page()
  remove_plugin_page()
  get_num_queries()
  get_queries()
  set_installed()
  is_installed()
  mysql_version()


Class: YDB  - X-Ref

__construct($dsn, $user, $pass, $options, $attributes)   X-Ref

since: 1.7.3
param: string $dsn         The data source name
param: string $user        The username
param: string $pass        The password
param: array  $options     Driver-specific options
param: array  $attributes  Attributes to set after a connection

init()   X-Ref
Init everything needed

Everything we need to set up is done here in init(), not in the constructor, so even
when the connection fails (eg config error or DB dead), the constructor has worked
and we have a $ydb object properly instantiated (and for instance yourls_die() can
correctly die, even if using $ydb methods)

since: 1.7.3
return: void

set_emulate_state()   X-Ref
Check if we emulate prepare statements, and set bool flag accordingly

Check if current driver can PDO::getAttribute(PDO::ATTR_EMULATE_PREPARES)
Some combinations of PHP/MySQL don't support this function. See
https://travis-ci.org/YOURLS/YOURLS/jobs/271423782#L481

since: 1.7.3
return: void

get_emulate_state()   X-Ref
Get emulate status

since: 1.7.3
return: bool

connect_to_DB()   X-Ref
Initiate real connection to DB server

This is to check that the server is running and/or the config is OK

since: 1.7.3
return: void

dead_or_error(\Exception $exception)   X-Ref
Die with an error message

since: 1.7.3
return: void
param: \Exception $exception

start_profiler()   X-Ref
Start a Message Logger

since: 1.7.3
return: void

set_html_context($context)   X-Ref

return: void
param: string $context

get_html_context()   X-Ref

return: string

set_option($name, $value)   X-Ref

return: void
param: string $name
param: mixed  $value

has_option($name)   X-Ref

return: bool
param: string $name

get_option($name)   X-Ref

return: string
param: string $name

delete_option($name)   X-Ref

return: void
param: string $name

set_infos($keyword, $infos)   X-Ref

return: void
param: string $keyword
param: mixed  $infos

has_infos($keyword)   X-Ref

return: bool
param: string $keyword

get_infos($keyword)   X-Ref

return: array
param: string $keyword

delete_infos($keyword)   X-Ref

return: void
param: string $keyword

get_plugins()   X-Ref

return: array

set_plugins(array $plugins)   X-Ref

return: void
param: array $plugins

add_plugin($plugin)   X-Ref

return: void
param: string $plugin  plugin filename

remove_plugin($plugin)   X-Ref

return: void
param: string $plugin  plugin filename

get_plugin_pages()   X-Ref

return: array

set_plugin_pages(array $pages)   X-Ref

return: void
param: array $pages

add_plugin_page( $slug, $title, $function )   X-Ref

return: void
param: string   $slug
param: string   $title
param: callable $function

remove_plugin_page( $slug )   X-Ref

return: void
param: string $slug

get_num_queries()   X-Ref
Return count of SQL queries performed

since: 1.7.3
return: int

get_queries()   X-Ref
Return SQL queries performed

since: 1.7.3
return: array

set_installed($bool)   X-Ref
Set YOURLS installed state

since: 1.7.3
return: void
param: bool $bool

is_installed()   X-Ref
Get YOURLS installed state

since: 1.7.3
return: bool

mysql_version()   X-Ref
Return standardized DB version

The regex removes everything that's not a number at the start of the string, or remove anything that's not a number and what
follows after that.
'omgmysql-5.5-ubuntu-4.20' => '5.5'
'mysql5.5-ubuntu-4.20'     => '5.5'
'5.5-ubuntu-4.20'          => '5.5'
'5.5-beta2'                => '5.5'
'5.5'                      => '5.5'

since: 1.7.3
return: string



Generated: Tue Jan 21 05:10:11 2025 Cross-referenced by PHPXref 0.7.1