Gallery:设计资料:完整性检查
来自站长百科
This document serves as a list of integrity checks that should be implemented in an official integrity module.
Requirements
- Check the integrity of the database
- Check the integrity of DB vs storage folder (filesystem)
- Expose via UI in site admin
- Expose via lib/support/ in case the installation is hosed up to a degree that site admin can't be accessed anymore
Checks
Disable disk cache for checking
Check Entities
Foreach entity describeEntity entity and check that each table contains a row for this entity (e.g. by loading the entity)
Foreach entity table verify that there's a corresponding entry in the Entity table
Check References (Undocumented Foreign Keys)
- ChildEntity.parentId -> Entity.id - Derivative.derivativeSourceId - Entity.linkId -> Entity.id && entityType must be the same - Comment.commenterId -> User.id - AlbumItem.theme -> PluginMap.pluginId && active
For Maps too...
- UserGroupMap.userId -> User.id - UserGroupMap.groupId -> Group.id - AccessMap.userOrGroupId -> Entity.id - AccessSubscriberMap.itemId -> Item.id - AccessSUbscriberMap.accessListId -> AccessMap.accessListId - CustomfieldMap.itemId -> Item.id - PluginParameterMap.itemId -> Entity.id - DerivativePrefsMap.itemId -> Item.id - DescendentCountsMap.userId -> User.id - DescendentCountsMap.itemId -> Item.id - ExternalIdMap.entityId -> Entity.id - ExternalIdMap.entityType -> describeEntity hit (no miss) - G1MigrateMap.itemId -> Item.id - etc.
Check Database vs Filesystem
Foreach FilesystemEntity as entity file_exists entity.fetchPath() Foreach g2data/albums/ as logicPath verify that a corresponding FilesystemEntity exists for logicPath
Check Filesystem permissions
Foreach g2data/ as file is_writeable file
More Checks
- id.everybodyGroup -> Group.id
- id.anonymousUser -> User.id && user only in everybody group
- id.adminGroup -> Group.id && groupType == GROUP_SITE_ADMINS
- existence of 1 or more site admins
- check root album id and other core plugin params
- verify that admins have access to all items / permissions for everything
- factory -> verify factory entries
- toolkit operations, post filters (missing files, missing operations)