Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database and storage integrity check and clean-up #5

Draft
wants to merge 50 commits into
base: develop
Choose a base branch
from

Conversation

adriendupuis
Copy link
Owner

@adriendupuis adriendupuis commented Jun 10, 2020

  • Remove unused files from storage.
  • Check that for each location, all its ancestors still exist.
  • Check that for each content object, there is at least one version and if it's the published one
  • Check that for each content object field, there is a content type field definition.
  • Check ezcontentobject.is_hidden, ezcontentobject_tree.is_hidden and ezcontentobject_tree.is_invisible consistency
  • Check that
    • database declared languages are available in config (common recurrent omission) (see 18376c4)
    • languages used by content are still available (after removing an used language)

foreach ($this->integrityService->findUnusedImageDirectories() as $dirPath) {
$output->writeln("Remove unused $dirPath");
if (!$input->getOption('dry-run')) {
shell_exec("rm -rf $dirPath");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

str_replace('/images/', '/images/_aliases/*/', $dirPath)

@adriendupuis
Copy link
Owner Author

adriendupuis commented Dec 22, 2020

-- Content objects with missing attribute

SELECT co.id, co.current_version, cc.identifier, cca.identifier
  FROM ezcontentobject AS co
    JOIN ezcontentclass AS cc ON cc.id = co.contentclass_id AND NOT cc.version
    JOIN ezcontentclass_attribute AS cca ON cc.id = cca.contentclass_id
    LEFT JOIN ezcontentobject_attribute AS coa ON cca.id = coa.contentclassattribute_id AND co.current_version = coa.version
  WHERE coa.id IS NULL
;

-- Content objects with undefined attribute

SELECT co.id, cc.identifier, coa.data_type_string, coa.contentclassattribute_id, coa.id
  FROM ezcontentobject AS co
    JOIN ezcontentclass AS cc ON cc.id = co.contentclass_id
    JOIN ezcontentobject_attribute AS coa ON co.id = coa.contentobject_id AND co.current_version = coa.version
    LEFT JOIN ezcontentclass_attribute AS cca ON cca.id = coa.contentclassattribute_id
  WHERE cca.id IS NULL
;

TODO: languages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant