public function SystemTable::systemUpdateFilesDatabase in X Autoload 7.5
Parameters
object[] $files:
string $type:
See also
system_update_files_database()
File
- tests/
src/ VirtualDrupal/ SystemTable.php, line 264
Class
- SystemTable
- Virtual Drupal database / persistence layer.
Namespace
Drupal\xautoload\Tests\VirtualDrupalCode
public function systemUpdateFilesDatabase(&$files, $type) {
// Add all files that need to be deleted to a DatabaseCondition.
foreach ($this
->systemTableObjects(NULL, $type) as $record) {
if (isset($files[$record->name]) && is_object($files[$record->name])) {
$file = $files[$record->name];
// Scan remaining fields to find only the updated values.
foreach ($record as $key => $oldvalue) {
if (isset($file->{$key})) {
$this->systemTableData[$record->name][$key] = $file->{$key};
}
}
// Indicate that the file exists already.
$file->exists = TRUE;
}
else {
// File is not found in file system, so delete record from the system table.
unset($this->systemTableData[$record->name]);
}
}
// All remaining files are not in the system table, so we need to add them.
foreach ($files as $name => $file) {
if (isset($file->exists)) {
unset($file->exists);
}
else {
$this->systemTableData[$name] = array(
'filename' => $file->uri,
'name' => $file->name,
'type' => $type,
'owner' => isset($file->owner) ? $file->owner : '',
'info' => $file->info,
'status' => 0,
'bootstrap' => 0,
'schema_version' => -1,
'weight' => 0,
);
$file->type = $type;
$file->status = 0;
$file->schema_version = -1;
}
}
}