PHP Class ImportModel, vanilla

Inheritance: extends Gdn_Model
Afficher le fichier Open project: vanilla/vanilla Class Usage Examples

Méthodes publiques

Свойство Type Description
$CurrentStep Track what step of this process we're on.
$Data array
$ErrorType Error to return.
$ImportPath File location.
$MaxStepTime Max seconds to run a single step.
$Timer Used for timing various long running methods to break them up into pieces.

Protected Properties

Свойство Type Description
$_MergeSteps Method names in order they are called during a merge.
$_OverwriteSteps Method names in order they are called during a clean slate import from file.
$_OverwriteStepsDb Steps for importing from database.

Méthodes publiques

Méthode Description
__construct ( $ImportPath = '' ) Set the import path.
addActivity ( ) : boolean
assignOtherIDs ( ) : boolean
assignUserIDs ( ) : boolean
authenticateAdminUser ( ) : boolean
customFinalization ( ) : boolean
data ( $Key, null $Value = null ) : mixed
defineIndexes ( ) : boolean
defineTables ( ) : boolean
deleteFiles ( )
deleteOverwriteTables ( ) Remove the data from the appropriate tables when we are overwriting the forum.
deleteState ( )
fGetCSV2 ( $fp, string $Delim = ',', string $Quote = '"', string $Escape = "\" ) : array
fromPost ( $Post )
generateSQL ( null $Value = null ) : mixed
getCountSQL ( string $Aggregate, string $ParentTable, string $ChildTable, string $ParentColumnName = '', string $ChildColumnName = '', string $ParentJoinColumn = '', string $ChildJoinColumn = '' ) : Gdn_DataSet Return SQL for updating a count.
getCustomImportModel ( ) Get a custom import model based on the import's source.
getImportHeader ( null $fpin = null ) : array | mixed | string
getPasswordHashMethod ( ) : mixed | string
importExists ( string $Table, string $Column = '' ) : boolean Checks to see of a table and/or column exists in the import data.
initialize ( ) : boolean
insertPermissionTable ( ) : boolean
insertTables ( ) : boolean
insertUserTable ( ) : boolean
isDbSource ( ) : boolean | string
loadState ( )
loadTable ( $Tablename, $Path ) : boolean
loadTableInsert ( string $Tablename, string $Path, boolean $skipHeader = true, integer $chunk = 100 ) : boolean Import a table from a CSV using SQL insert statements.
loadTableType ( boolean $Save = true ) : boolean | mixed | string
loadTables ( ) : boolean
loadUserTable ( ) : boolean
localInfileSupported ( ) : boolean
overwrite ( string $Overwrite = '', string $Email = '', string $Password = '' ) : mixed
parseInfoLine ( $Line ) : array
processImportDb ( ) Process the import tables from the database.
processImportFile ( ) : boolean
query ( string $Sql, array $Parameters = null ) : Gdn_DataSet Run a query, replacing database prefixes.
runStep ( integer $Step = 1 ) : mixed Run the step in the import.
saveSQL ( $CurrentStep )
saveState ( )
setCategoryPermissionIDs ( ) Set the category permissions based on the permission table.
setRoleDefaults ( )
stat ( $Key, null $Value = null, string $Op = 'set' ) : mixed
steps ( ) : array
tables ( string $TableName = '' ) : mixed
toPost ( &$Post )
updateCounts ( ) : boolean
verifyImport ( ) Verify imported data.

Méthodes protégées

Méthode Description
_InsertTable ( $TableName, array $Sets = [] ) : boolean | integer | void
_LoadTableLocalInfile ( $Tablename, $Path )
_LoadTableOnSameServer ( $Tablename, $Path )
_LoadTableWithInsert ( $Tablename, $Path ) : boolean
_assignIDs ( $TableName, null $PrimaryKey = null, null $SecondaryKey = null ) : boolean | void
_setCategoryPermissionIDs ( $Category, $PermissionID, $IDs )
backTick ( $Str ) : string

Method Details

_InsertTable() protected méthode

protected _InsertTable ( $TableName, array $Sets = [] ) : boolean | integer | void
$TableName
$Sets array
Résultat boolean | integer | void

_LoadTableLocalInfile() protected méthode

protected _LoadTableLocalInfile ( $Tablename, $Path )
$Tablename
$Path

_LoadTableOnSameServer() protected méthode

protected _LoadTableOnSameServer ( $Tablename, $Path )
$Tablename
$Path

_LoadTableWithInsert() protected méthode

protected _LoadTableWithInsert ( $Tablename, $Path ) : boolean
$Tablename
$Path
Résultat boolean

__construct() public méthode

Set the import path.
public __construct ( $ImportPath = '' )

_assignIDs() protected méthode

protected _assignIDs ( $TableName, null $PrimaryKey = null, null $SecondaryKey = null ) : boolean | void
$TableName
$PrimaryKey null
$SecondaryKey null
Résultat boolean | void

_setCategoryPermissionIDs() protected méthode

protected _setCategoryPermissionIDs ( $Category, $PermissionID, $IDs )
$Category
$PermissionID
$IDs

addActivity() public méthode

public addActivity ( ) : boolean
Résultat boolean

assignOtherIDs() public méthode

public assignOtherIDs ( ) : boolean
Résultat boolean

assignUserIDs() public méthode

public assignUserIDs ( ) : boolean
Résultat boolean

authenticateAdminUser() public méthode

public authenticateAdminUser ( ) : boolean
Résultat boolean

backTick() protected static méthode

protected static backTick ( $Str ) : string
$Str
Résultat string

customFinalization() public méthode

public customFinalization ( ) : boolean
Résultat boolean

data() public méthode

public data ( $Key, null $Value = null ) : mixed
$Key
$Value null
Résultat mixed

defineIndexes() public méthode

public defineIndexes ( ) : boolean
Résultat boolean

defineTables() public méthode

public defineTables ( ) : boolean
Résultat boolean

deleteFiles() public méthode

public deleteFiles ( )

deleteOverwriteTables() public méthode

Remove the data from the appropriate tables when we are overwriting the forum.

deleteState() public méthode

public deleteState ( )

fGetCSV2() public static méthode

public static fGetCSV2 ( $fp, string $Delim = ',', string $Quote = '"', string $Escape = "\" ) : array
$fp
$Delim string
$Quote string
$Escape string
Résultat array

fromPost() public méthode

public fromPost ( $Post )
$Post

generateSQL() public méthode

public generateSQL ( null $Value = null ) : mixed
$Value null
Résultat mixed

getCountSQL() public méthode

Return SQL for updating a count.
public getCountSQL ( string $Aggregate, string $ParentTable, string $ChildTable, string $ParentColumnName = '', string $ChildColumnName = '', string $ParentJoinColumn = '', string $ChildJoinColumn = '' ) : Gdn_DataSet
$Aggregate string count, max, min, etc.
$ParentTable string The name of the parent table.
$ChildTable string The name of the child table
$ParentColumnName string
$ChildColumnName string
$ParentJoinColumn string
$ChildJoinColumn string
Résultat Gdn_DataSet

getCustomImportModel() public méthode

Get a custom import model based on the import's source.

getImportHeader() public méthode

public getImportHeader ( null $fpin = null ) : array | mixed | string
$fpin null
Résultat array | mixed | string

getPasswordHashMethod() public méthode

public getPasswordHashMethod ( ) : mixed | string
Résultat mixed | string

importExists() public méthode

Checks to see of a table and/or column exists in the import data.
public importExists ( string $Table, string $Column = '' ) : boolean
$Table string The name of the table to check for.
$Column string
Résultat boolean

initialize() public méthode

public initialize ( ) : boolean
Résultat boolean

insertPermissionTable() public méthode

public insertPermissionTable ( ) : boolean
Résultat boolean

insertTables() public méthode

public insertTables ( ) : boolean
Résultat boolean

insertUserTable() public méthode

public insertUserTable ( ) : boolean
Résultat boolean

isDbSource() public méthode

public isDbSource ( ) : boolean | string
Résultat boolean | string

loadState() public méthode

public loadState ( )

loadTable() public méthode

public loadTable ( $Tablename, $Path ) : boolean
$Tablename
$Path
Résultat boolean

loadTableInsert() public méthode

Import a table from a CSV using SQL insert statements.
public loadTableInsert ( string $Tablename, string $Path, boolean $skipHeader = true, integer $chunk = 100 ) : boolean
$Tablename string The name of the table to import to.
$Path string The path to the CSV.
$skipHeader boolean Whether the CSV contains a header row.
$chunk integer The number of records to chunk the imports to.
Résultat boolean Whether any records were found.

loadTableType() public méthode

public loadTableType ( boolean $Save = true ) : boolean | mixed | string
$Save boolean
Résultat boolean | mixed | string

loadTables() public méthode

public loadTables ( ) : boolean
Résultat boolean

loadUserTable() public méthode

public loadUserTable ( ) : boolean
Résultat boolean

localInfileSupported() public méthode

public localInfileSupported ( ) : boolean
Résultat boolean

overwrite() public méthode

public overwrite ( string $Overwrite = '', string $Email = '', string $Password = '' ) : mixed
$Overwrite string
$Email string
$Password string
Résultat mixed

parseInfoLine() public méthode

public parseInfoLine ( $Line ) : array
$Line
Résultat array

processImportDb() public méthode

Process the import tables from the database.
public processImportDb ( )

processImportFile() public méthode

public processImportFile ( ) : boolean
Résultat boolean

query() public méthode

Run a query, replacing database prefixes.
public query ( string $Sql, array $Parameters = null ) : Gdn_DataSet
$Sql string The sql to execute. - :_z will be replaced by the import prefix. - :_ will be replaced by the database prefix.
$Parameters array PDO parameters to pass to the query.
Résultat Gdn_DataSet

runStep() public méthode

Run the step in the import.
public runStep ( integer $Step = 1 ) : mixed
$Step integer the step to run.
Résultat mixed Whether the step succeeded or an array of information.

saveSQL() public méthode

public saveSQL ( $CurrentStep )
$CurrentStep

saveState() public méthode

public saveState ( )

setCategoryPermissionIDs() public méthode

Set the category permissions based on the permission table.

setRoleDefaults() public méthode

public setRoleDefaults ( )

stat() public méthode

public stat ( $Key, null $Value = null, string $Op = 'set' ) : mixed
$Key
$Value null
$Op string
Résultat mixed

steps() public méthode

public steps ( ) : array
Résultat array

tables() public méthode

public tables ( string $TableName = '' ) : mixed
$TableName string
Résultat mixed

toPost() public méthode

public toPost ( &$Post )
$Post

updateCounts() public méthode

public updateCounts ( ) : boolean
Résultat boolean

verifyImport() public méthode

Verify imported data.
public verifyImport ( )

Property Details

$CurrentStep public_oe property

Track what step of this process we're on.
public $CurrentStep

$Data public_oe property

public array $Data
Résultat array

$ErrorType public_oe property

Error to return.
public $ErrorType

$ImportPath public_oe property

File location.
public $ImportPath

$MaxStepTime public_oe property

Max seconds to run a single step.
public $MaxStepTime

$Timer public_oe property

Used for timing various long running methods to break them up into pieces.
public $Timer

$_MergeSteps protected_oe property

Method names in order they are called during a merge.
protected $_MergeSteps

$_OverwriteSteps protected_oe property

Method names in order they are called during a clean slate import from file.
protected $_OverwriteSteps

$_OverwriteStepsDb protected_oe property

Steps for importing from database.
protected $_OverwriteStepsDb