Skip to content

Commit

Permalink
API Split apart Versioned and Staged
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Oct 29, 2024
1 parent a7e5891 commit e987568
Show file tree
Hide file tree
Showing 45 changed files with 58 additions and 50 deletions.
2 changes: 1 addition & 1 deletion _config/versionedextension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ Name: versioned-table
---
SilverStripe\ORM\DataQuery:
extensions:
- SilverStripe\Versioned\VersionedTableDataQueryExtension
- SilverStripe\Versioned\Staged\VersionedTableDataQueryExtension
8 changes: 4 additions & 4 deletions _config/versionedownership.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ Name: versionedownership
---
SilverStripe\ORM\DataObject:
extensions:
RecursivePublishable: SilverStripe\Versioned\RecursivePublishable
RecursivePublishable: SilverStripe\Versioned\Staged\RecursivePublishable

SilverStripe\Core\Injector\Injector:
SilverStripe\Versioned\RecursiveStagesInterface:
class: SilverStripe\Versioned\RecursiveStagesService
SilverStripe\Versioned\Staged\RecursiveStagesInterface:
class: SilverStripe\Versioned\Staged\RecursiveStagesService
---
Name: versionedownership-admin
OnlyIf:
ModuleExists: silverstripe/admin
---
SilverStripe\Admin\LeftAndMain:
extensions:
RecursivePublishableHandler: SilverStripe\Versioned\RecursivePublishableHandler
RecursivePublishableHandler: SilverStripe\Versioned\Staged\RecursivePublishableHandler
2 changes: 1 addition & 1 deletion _config/versionedrequestprocessors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ SilverStripe\Core\Injector\Injector:
SilverStripe\Control\Director:
properties:
Middlewares:
VersionedMiddleware: '%$SilverStripe\Versioned\VersionedHTTPMiddleware'
VersionedMiddleware: '%$SilverStripe\Versioned\Staged\VersionedHTTPMiddleware'
2 changes: 1 addition & 1 deletion src/ChangeSet.php → src/Staged/ChangeSet.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace SilverStripe\Versioned;
namespace SilverStripe\Versioned\Staged;

use BadMethodCallException;
use Exception;
Expand Down
3 changes: 2 additions & 1 deletion src/ChangeSetItem.php → src/Staged/ChangeSetItem.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace SilverStripe\Versioned;
namespace SilverStripe\Versioned\Staged;

use BadMethodCallException;
use InvalidArgumentException;
Expand All @@ -17,6 +17,7 @@
use SilverStripe\Security\Member;
use SilverStripe\Security\Permission;
use SilverStripe\Security\Security;
use SilverStripe\Versioned\Versioned;

/**
* A single line in a changeset
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php


namespace SilverStripe\Versioned;
namespace SilverStripe\Versioned\Staged;

use InvalidArgumentException;
use SilverStripe\Core\ClassInfo;
Expand All @@ -12,6 +12,8 @@
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\Queries\SQLUpdate;
use SilverStripe\Model\List\SS_List;
use SilverStripe\Versioned\Versioned;
use SilverStripe\Versioned\ReadingMode;

/**
* Provides owns / owned_by and recursive publishing API for all objects.
Expand Down Expand Up @@ -84,7 +86,7 @@ public function publishRecursive()
);

$changeset->write();
$changeset->addObject($owner);
$changeset->addObject($owner); // will add a ChangeSetItem to $changeset->Changes()

$result = $changeset->publish(true);
if (!$result) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

namespace SilverStripe\Versioned;
namespace SilverStripe\Versioned\Staged;

use SilverStripe\Admin\LeftAndMain;
use SilverStripe\Core\Extension;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\Versioned;

/**
* Provides recursive publishable behaviour for LeftAndMain and GridFieldDetailForm_ItemRequest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace SilverStripe\Versioned;
namespace SilverStripe\Versioned\Staged;

use SilverStripe\ORM\DataObject;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php

namespace SilverStripe\Versioned;
namespace SilverStripe\Versioned\Staged;

use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Resettable;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\Versioned;

/**
* Functionality for detecting the need of publishing nested objects owned by common parent / ancestor object
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace SilverStripe\Versioned;
namespace SilverStripe\Versioned\Staged;

use SilverStripe\Control\Controller;
use SilverStripe\Control\Director;
Expand All @@ -10,6 +10,7 @@
use SilverStripe\Core\Convert;
use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\Security\Security;
use SilverStripe\Versioned\Versioned;

/**
* Initialises the versioned stage when a request is made.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php

namespace SilverStripe\Versioned;
namespace SilverStripe\Versioned\Staged;

use SilverStripe\Core\Extensible;
use SilverStripe\Core\Extension;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\DataQuery;
use SilverStripe\Versioned\Versioned;

/**
* Applies correct stage to tables
Expand Down
1 change: 1 addition & 0 deletions src/Versioned.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use SilverStripe\Security\Permission;
use SilverStripe\Security\Security;
use SilverStripe\View\TemplateGlobalProvider;
use SilverStripe\Versioned\Staged\RecursiveStagesInterface;

/**
* The Versioned extension allows your DataObjects to have several versions,
Expand Down
2 changes: 1 addition & 1 deletion tests/php/ChangeSetItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace SilverStripe\Versioned\Tests;

use SilverStripe\Versioned\ChangeSetItem;
use SilverStripe\Versioned\Staged\ChangeSetItem;
use SilverStripe\Dev\SapphireTest;

class ChangeSetItemTest extends SapphireTest
Expand Down
4 changes: 2 additions & 2 deletions tests/php/ChangeSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use SebastianBergmann\Comparator\ComparisonFailure;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\ChangeSet;
use SilverStripe\Versioned\ChangeSetItem;
use SilverStripe\Versioned\Staged\ChangeSet;
use SilverStripe\Versioned\Staged\ChangeSetItem;
use SilverStripe\Versioned\Tests\ChangeSetTest\BaseObject;
use SilverStripe\Versioned\Tests\ChangeSetTest\ChangeSetSyncStub;
use SilverStripe\Versioned\Tests\ChangeSetTest\MidObject;
Expand Down
2 changes: 1 addition & 1 deletion tests/php/ChangeSetTest/ChangeSetSyncStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace SilverStripe\Versioned\Tests\ChangeSetTest;

use SilverStripe\Dev\TestOnly;
use SilverStripe\Versioned\ChangeSet;
use SilverStripe\Versioned\Staged\ChangeSet;

class ChangeSetSyncStub extends ChangeSet implements TestOnly
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/php/PublishRecursive/PublishRecursiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

class PublishRecursiveTest extends SapphireTest
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedDeletedVersionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Tests\VersionsDeletedVersionsTest\CompanyOfficeLocation;
use SilverStripe\Versioned\Tests\VersionsDeletedVersionsTest\CompanyPage;
use SilverStripe\Versioned\Tests\VersionsDeletedVersionsTest\GalleryBlock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;

/**
* @mixin RecursivePublishable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;

/**
* @mixin RecursivePublishable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\ManyManyThroughList;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/php/VersionedOwnershipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace SilverStripe\Versioned\Tests;

use SilverStripe\Versioned\ChangeSet;
use SilverStripe\Versioned\ChangeSetItem;
use SilverStripe\Versioned\Staged\ChangeSet;
use SilverStripe\Versioned\Staged\ChangeSetItem;
use SilverStripe\Versioned\Tests\VersionedOwnershipTest\Attachment;
use SilverStripe\Versioned\Tests\VersionedOwnershipTest\Banner;
use SilverStripe\Versioned\Tests\VersionedOwnershipTest\Image;
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedOwnershipTest/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedOwnershipTest/Banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedOwnershipTest/CustomRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedOwnershipTest/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedOwnershipTest/OwnedByUnversioned.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedOwnershipTest/Related.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedOwnershipTest/RelatedMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedOwnershipTest/TestObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedOwnershipTest/TestPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedOwnershipTest/UnversionedOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;

/**
* @mixin RecursivePublishable
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Security\IdentityStore;
use SilverStripe\Versioned\ChangeSet;
use SilverStripe\Versioned\Staged\ChangeSet;
use SilverStripe\Versioned\Versioned;

class VersionedTest extends SapphireTest
Expand Down
2 changes: 1 addition & 1 deletion tests/php/VersionedTest/ChangeSetTestObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\HasManyList;
use SilverStripe\ORM\ManyManyList;
use SilverStripe\Versioned\RecursivePublishable;
use SilverStripe\Versioned\Staged\RecursivePublishable;
use SilverStripe\Versioned\Versioned;
use SilverStripe\ORM\Hierarchy\Hierarchy;

Expand Down
Loading

0 comments on commit e987568

Please sign in to comment.