Same name in other branches
  1. 5.0.x src/Form/InfoForm.php \Drupal\advagg\Form\InfoForm::getFileInfo()
  2. 6.0.x src/Form/InfoForm.php \Drupal\advagg\Form\InfoForm::getFileInfo()
  3. 8.x-3.x src/Form/InfoForm.php \Drupal\advagg\Form\InfoForm::getFileInfo()
  4. 8.x-4.x src/Form/InfoForm.php \Drupal\advagg\Form\InfoForm::getFileInfo()

Get detailed info about the given filename.

Paramètres

string $filename: Name of file to lookup.

Return value

array Returns an array of detailed info about this file.

2 calls to InfoForm::getFileInfo()
InfoForm::getFileInfoAjax dans src/Form/InfoForm.php
Display file info via ajax callback.
InfoForm::getFileInfoSubmit dans src/Form/InfoForm.php
Display file info in a drupal message.

Fichier

src/Form/InfoForm.php, line 353

Classe

InfoForm
View AdvAgg information for this site.

Namespace

Drupal\advagg\Form

Code

private function getFileInfo($filename) {
    // Strip quotes and trim.
    $filename = trim(str_replace([
        '"',
        "'",
    ], '', $filename));
    if (substr_compare($filename, 'css_', 0) > 0 || substr_compare($filename, 'js_', 0) > 0) {
        $results = array_column($this->advaggAggregates
            ->getAll(), NULL, 'uid');
        if (isset($results[$filename])) {
            return $results[$filename];
        }
        else {
            return "Aggregate name unrecognized, confirm spelling, otherwise likely a very old aggregate that has been expunged.";
        }
    }
    elseif ($data = $this->advaggFiles
        ->get($filename)) {
        $data['File modification date'] = $this->dateFormatter
            ->format($data['mtime'], 'html_datetime');
        $data['Information last update'] = $this->dateFormatter
            ->format($data['updated'], 'html_datetime');
        return $data;
    }
    else {
        return "File not found and AdvAgg has no record of it. Confirm spelling of the path.";
    }
}