SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class DbToolsController

Provides tools for dealing with the database
Tools include a sync tool and a structure viewer

Variables

NameVisibilityDescription
$action_log
Should this controller log add/edit/delete actions?
$module_builder_type_guess (static)
For a given field name, a type to use which is better than VARCHAR(200)
$template_enabled 
$tools (static)
List of tools to show in the sidebar and index view

Functions

NameVisibilityDescription
__callpublicHandles methods that do not exist.
__constructpublicConstructor
_runpublicThe router/kohana will invoke this method to invoke an action.
ajaxPageIdspublicRender page drop-down for given sub-site
ajaxTableDefnpublic 
apipublicRender API test form within DB tools
autoSetEmptyParamprotectedAuto-set the "empty" param for fields with foreign keys to be NULL
bcryptSpeedpublicBenchmark the server to find appropriate cost parameter
deleteRecordprotectedDeletes a record, and logs the deletion
emailpublicRenders form to send emails
emailSendpublicProcess form submission
exceptionDetailpublicBrowse recent exceptions - details
exceptionLogpublicBrowse and search exceptions
exportActionpublicDoes the actual export
exportFilespublicUI to export all files
exportFilesActionpublicAction to export all files
exportTablespublicExport tables to an SQL file
fileTypesIndexingSupportpublicReturns a list of file types which can be indexed for fulltext search
generateFormViewprotectedGenerates a form view from a JSON config file
generatePasswordHashpublicGenerate a password hash to store in a config file
getCssClassNamepublicReturn the class name for this controller, expressed in CSS style, i.e. with dashes
getModulePathpublicGets the relative path to the module the controller lives in, or sprout itself
gettempfilepublicAllows files to be downloaded from the temporary directory
importActionpublicAction for importing tables
importFileActionpublicAction for importing files
importFilespublicImports a files into the cms
importOptionspublic 
importSavepublic 
importTablespublicImport database tables from a .sql file
importXMLpublicRenders form to imoprt Sprout2 Export XML
importXmlActionpublicProcess Sprout2 Export XML into this CMS
indexpublicShows a list of database tools
infopublicOutput some sprout and platform info
jsonExtraValidateprotectedDo any additional validation prior to saving the record
launchCheckspublicRun a series of self-tests to ensure everything is configured correctly
listRoutespublic 
loadEditJsonprotectedLoads a JSON config file for an automated edit-type form for this controller
loadFormJsonprotectedLoads a config file for a JsonForm associated with this controller
loadRecordprotectedFetches the pre-update record from the database.
logActionprotectedStores a history item in the database, recording an add (i.e. insert), edit, or delete.
logAddprotectedLogs an add action. This is a wrapper for Controller::logAction
logAddCategoryprotectedLogs the adding of a record to a category. This is a wrapper for Controller::logAction
logDeleteprotectedLogs a delete action. This is a wrapper for Controller::logAction
logDeleteCategoryprotectedLogs the removal of a record from a category. This is a wrapper for Controller::logAction
logEditprotectedLogs an edit action. This is a wrapper for Controller::logAction
moduleBuilderpublicGenerates blank modules
moduleBuilderActionpublic 
moduleBuilderDbpublicGenerates db_struct.xml content for a module
moduleBuilderExistingpublicGenerates modules from an existing db_struct.xml file
moduleBuilderExistingActionpublicGenerates modules from an existing db_struct.xml file
moduleBuilderExistingFormpublicGenerates modules from an existing db_struct.xml file
moduleBuilderExistingUploadActionpublicGenerates modules from an existing db_struct.xml file
mtTransformpublic (static)Used by the module_template_action method
multimakepublicGenerate multiedit code
outputSqlResultsetprivateRenders SQL result set into a table
qrCodeFormpublicRender form to set QR Code string
qrCodeImagepublicRenders QR code image
replaceSetprotectedInserts records which are in $new_records, but are not in the specified table
saveJsonDataprotectedAutomatically saves the data associated with a submission on a JSON-generated form
sessionEditorpublicEdit the $_SESSION
sessionEditorActionpublicSession Editor Action
sessionLoopprivateList items in an array, along with the tools buttons
sizeToHumanprivateRender table data size in human readable form
splitSqlprivateSplits a set of SQL queries into individual queries
sqlpublicAllows the user to execute SQL queries
sqlcsvpublic 
structpublicShows table and column definitions
syncpublicSyncs the db structure to match db_struct.xml
templateprivateRender dbtools template
testSkinTemplatespublicSimple tool for testing skin templates
testSkinTemplatesActionpublicActual viewing UI for templates
varDumppublicRender view to see session and cookie data
xmlGetColumnsprivate (static) 
xmlGetTablesprivate (static) 
xmlLoadprivate (static) 

public __call (from BaseController)

void $BaseController->__call ( string $method , array $args );

Handles methods that do not exist.

public __construct

void $DbToolsController->__construct ( );

Constructor

public _run (from BaseController)

void $BaseController->_run ( mixed $method , mixed $args );

The router/kohana will invoke this method to invoke an action.

If you please, you may wrap this method to create before/after hooks.

public ajaxPageIds

void $DbToolsController->ajaxPageIds ( int $subsite_id );

Render page drop-down for given sub-site

public ajaxTableDefn

void $DbToolsController->ajaxTableDefn ( mixed $table );

This function does not have a description

public api

void $DbToolsController->api ( string $class , string $method );

Render API test form within DB tools

protected autoSetEmptyParam (from Controller)

null $Controller->autoSetEmptyParam ( array &$conf );

Auto-set the "empty" param for fields with foreign keys to be NULL

This greatly reduces the number of foreign-key constraints hit in day-to-day use,
especially with file fields.

public bcryptSpeed

void $DbToolsController->bcryptSpeed ( );

Benchmark the server to find appropriate cost parameter

protected deleteRecord (from Controller)

int $Controller->deleteRecord ( string $table , int $record_id [, int $parent_log_id ] );

Deletes a record, and logs the deletion
This should be used by all _deleteSave methods
Starts a transaction and commits it if not already in a transaction when called

public email

void $DbToolsController->email ( );

Renders form to send emails

public emailSend

void $DbToolsController->emailSend ( );

Process form submission

public exceptionDetail

void $DbToolsController->exceptionDetail ( );

Browse recent exceptions - details

public exceptionLog

void $DbToolsController->exceptionLog ( );

Browse and search exceptions

public exportAction

void $DbToolsController->exportAction ( );

Does the actual export

public exportFiles

void $DbToolsController->exportFiles ( );

UI to export all files

public exportFilesAction

void $DbToolsController->exportFilesAction ( );

Action to export all files

public exportTables

void $DbToolsController->exportTables ( );

Export tables to an SQL file

public fileTypesIndexingSupport

void $DbToolsController->fileTypesIndexingSupport ( );

Returns a list of file types which can be indexed for fulltext search

protected generateFormView (from Controller)

array $Controller->generateFormView ( mixed $file_name );

Generates a form view from a JSON config file

public generatePasswordHash

void $DbToolsController->generatePasswordHash ( );

Generate a password hash to store in a config file
The username and hash are used by AdminAuth::processLocal

public getCssClassName (from BaseController)

string $BaseController->getCssClassName ( );

Return the class name for this controller, expressed in CSS style, i.e. with dashes

Example: When called from BlogPostController --> 'blog-post-controller'

public getModulePath (from BaseController)

string $BaseController->getModulePath ( );

Gets the relative path to the module the controller lives in, or sprout itself

public gettempfile

void $DbToolsController->gettempfile ( string $source , string $tempfile [, string $orig ] );

Allows files to be downloaded from the temporary directory

Only certain files from the temp directory can be downloaded.
Each 'source' has a regex which is used to restrict downloads to only that particular type of file

public importAction

void $DbToolsController->importAction ( );

Action for importing tables

public importFileAction

void $DbToolsController->importFileAction ( );

Action for importing files

public importFiles

void $DbToolsController->importFiles ( );

Imports a files into the cms

public importOptions

void $DbToolsController->importOptions ( );

This function does not have a description

public importSave

void $DbToolsController->importSave ( );

This function does not have a description

public importTables

void $DbToolsController->importTables ( );

Import database tables from a .sql file

public importXML

void $DbToolsController->importXML ( );

Renders form to imoprt Sprout2 Export XML

public importXmlAction

void $DbToolsController->importXmlAction ( );

Process Sprout2 Export XML into this CMS

public index

void $DbToolsController->index ( );

Shows a list of database tools

public info

void $DbToolsController->info ( );

Output some sprout and platform info

protected jsonExtraValidate (from Controller)

void $Controller->jsonExtraValidate ( int $id , Validator $validator );

Do any additional validation prior to saving the record

public launchChecks

unknown $DbToolsController->launchChecks ( );

Run a series of self-tests to ensure everything is configured correctly

public listRoutes

void $DbToolsController->listRoutes ( );

This function does not have a description

protected loadEditJson (from Controller)

array $Controller->loadEditJson ( );

Loads a JSON config file for an automated edit-type form for this controller

protected loadFormJson (from Controller)

array $Controller->loadFormJson ( string $file_name );

Loads a config file for a JsonForm associated with this controller

protected loadRecord (from Controller)

bool|array $Controller->loadRecord ( string $table , int $record_id );

Fetches the pre-update record from the database.
Used by the action log system, and disabled if the action log system has been turned off

protected logAction (from Controller)

int $Controller->logAction ( string $table , int $record_id , int $type , array $data [, int $parent_log_id ] );

Stores a history item in the database, recording an add (i.e. insert), edit, or delete.
Should be called AFTER the action has been made.
N.B. This is a low-level method; the friendlier wrapper methods are preferred;
e.g. Controller::logAdd, Controller::logEdit

protected logAdd (from Controller)

int $Controller->logAdd ( string $table , int $record_id );

Logs an add action. This is a wrapper for Controller::logAction

protected logAddCategory (from Controller)

int $Controller->logAddCategory ( string $table , int $record_id , int $cat_id );

Logs the adding of a record to a category. This is a wrapper for Controller::logAction

protected logDelete (from Controller)

int $Controller->logDelete ( string $table , int $record_id , array $data [, int $parent_log_id ] );

Logs a delete action. This is a wrapper for Controller::logAction

protected logDeleteCategory (from Controller)

int $Controller->logDeleteCategory ( string $table , int $record_id , int $cat_id );

Logs the removal of a record from a category. This is a wrapper for Controller::logAction

protected logEdit (from Controller)

int $Controller->logEdit ( string $table , int $record_id , array $data );

Logs an edit action. This is a wrapper for Controller::logAction

public moduleBuilder

void $DbToolsController->moduleBuilder ( );

Generates blank modules

public moduleBuilderAction

void $DbToolsController->moduleBuilderAction ( );

This function does not have a description

public moduleBuilderDb

void $DbToolsController->moduleBuilderDb ( );

Generates db_struct.xml content for a module

public moduleBuilderExisting

void $DbToolsController->moduleBuilderExisting ( );

Generates modules from an existing db_struct.xml file

public moduleBuilderExistingAction

void $DbToolsController->moduleBuilderExistingAction ( mixed $input_xml );

Generates modules from an existing db_struct.xml file

public moduleBuilderExistingForm

void $DbToolsController->moduleBuilderExistingForm ( mixed $input_xml );

Generates modules from an existing db_struct.xml file

public moduleBuilderExistingUploadAction

void $DbToolsController->moduleBuilderExistingUploadAction ( );

Generates modules from an existing db_struct.xml file

public mtTransform

unknown DbToolsController::mtTransform ( mixed $text );

Used by the module_template_action method

public multimake

void $DbToolsController->multimake ( );

Generate multiedit code

private outputSqlResultset

int $DbToolsController->outputSqlResultset ( PDOStatement $results [, mixed $headings ] );

Renders SQL result set into a table

public qrCodeForm

void $DbToolsController->qrCodeForm ( );

Render form to set QR Code string

public qrCodeImage

void $DbToolsController->qrCodeImage ( );

Renders QR code image

protected replaceSet (from Controller)

void $Controller->replaceSet ( string $table , array $new_records , array $conditions );

Inserts records which are in $new_records, but are not in the specified table
Deletes records which are in the specified table, but not in $new_records
Updates records which are in both

Matching is done on the 'id' field, as a result the $new_records arrays MUST contain an id field.

protected saveJsonData (from Controller)

bool $Controller->saveJsonData ( array $conf , int &$item_id [, string $mode ] );

Automatically saves the data associated with a submission on a JSON-generated form

public sessionEditor

void $DbToolsController->sessionEditor ( );

Edit the $_SESSION

public sessionEditorAction

void $DbToolsController->sessionEditorAction ( );

Session Editor Action

private sessionLoop

void $DbToolsController->sessionLoop ( mixed &$a , mixed $depth , mixed $keys );

List items in an array, along with the tools buttons

private sizeToHuman

string $DbToolsController->sizeToHuman ( int $size );

Render table data size in human readable form

private splitSql

unknown $DbToolsController->splitSql ( mixed $all );

Splits a set of SQL queries into individual queries

public sql

void $DbToolsController->sql ( );

Allows the user to execute SQL queries

public sqlcsv

void $DbToolsController->sqlcsv ( );

This function does not have a description

public struct

void $DbToolsController->struct ( [ mixed $arg ] );

Shows table and column definitions

public sync

void $DbToolsController->sync ( );

Syncs the db structure to match db_struct.xml

private template

void $DbToolsController->template ( string $main_title [, mixed $html ] );

Render dbtools template

public testSkinTemplates

void $DbToolsController->testSkinTemplates ( );

Simple tool for testing skin templates

public testSkinTemplatesAction

void $DbToolsController->testSkinTemplatesAction ( string $skin , string $tmpl );

Actual viewing UI for templates

public varDump

void $DbToolsController->varDump ( );

Render view to see session and cookie data

private xmlGetColumns

array DbToolsController::xmlGetColumns ( DOMDocument $doc , mixed $table_name );

This function does not have a description

private xmlGetTables

array DbToolsController::xmlGetTables ( DOMDocument $doc );

This function does not have a description

private xmlLoad

unknown DbToolsController::xmlLoad ( mixed $module );

This function does not have a description