fix: global-edit rules for every library entry that pages show (L2)
Divi renders any referenced et_pb_layout, whatever its scope term. A normal entry with usages now gets the dry run, confirm, P8a, backup and the site-wide GlobalItem scope; lit-divi-delete's notice and the library-list detail name its pages too. The usage scan is the same single query. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -113,10 +113,10 @@ final class LibraryFixtures
|
||||
}
|
||||
|
||||
/**
|
||||
* GlobalUsages whose query answers $rows (a closure is asked on every call); the rights checks
|
||||
* GlobalUsages whose query answers $rows (a closure gets the entry ID on every call); the rights checks
|
||||
* are the real ones, with the post-cache functions stubbed.
|
||||
*
|
||||
* @param list<array{id: int, status: string, type: string}>|\Closure(): list<array{id: int, status: string, type: string}> $rows
|
||||
* @param list<array{id: int, status: string, type: string}>|\Closure(int): list<array{id: int, status: string, type: string}> $rows
|
||||
*/
|
||||
public static function usages(array|\Closure $rows, ?DiviRoles $roles = null): GlobalUsages
|
||||
{
|
||||
@@ -124,7 +124,7 @@ final class LibraryFixtures
|
||||
Functions\when('_prime_post_caches')->justReturn(null);
|
||||
Functions\when('wp_cache_delete')->justReturn(true);
|
||||
$usages = Mockery::mock(GlobalUsages::class, [null, $roles ?? self::roles()])->makePartial();
|
||||
$usages->allows('rows')->andReturnUsing(static fn (): array => is_array($rows) ? $rows : $rows());
|
||||
$usages->allows('rows')->andReturnUsing(static fn (int $id): array => is_array($rows) ? $rows : $rows($id));
|
||||
|
||||
return $usages;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user