Skip to content

Commit

Permalink
#2 avoid installing a user group if it already exists; code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
1stthomas committed May 24, 2021
1 parent e64b649 commit 1c7a5d3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 28 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ht7/ht7_c5_base",
"type": "concrete5-package",
"keywords": ["concrete5", "package"],
"repositories": [
{
"type": "git",
Expand Down
40 changes: 12 additions & 28 deletions controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace Concrete\Package\Ht7C5Base;

use \Concrete\Core\Application\Application;
use \Concrete\Core\Asset\AssetList;
use \Concrete\Core\File\Filesystem;
use \Concrete\Core\Foundation\Service\ProviderList;
use \Concrete\Core\Package\Package;
use \Concrete\Core\Package\PackageService;
Expand Down Expand Up @@ -53,7 +51,8 @@ public function install()
$this->pkg = parent::install();
// Create all pages through the content XML.
$this->installContentFile('install.xml');
// Make sure the package helper can be accessed.
// Make sure the package helper can be accessed by later installation
// process' of this package.
$this->registerServices();
// If the path uses "-" to separate words and the filename
// uses "_", the cFilename on the Pages table is empty.
Expand All @@ -65,9 +64,7 @@ public function install()

public function on_start()
{
$this->registerAssets();
$this->registerServices();
$this->registerRoutes();
}

/**
Expand All @@ -80,23 +77,6 @@ private function fixFilenames()
->fixFilenames('/dashboard/ht7', $this->pkg);
}

private function registerAssets()
{

}

/**
* Register all routes defined in config/paths.php.
*
* This method let the route helper compose an array which can be used by
* calling <code>Route::registerMultiple($routesArray)</code>.
*
*/
public function registerRoutes()
{

}

public function upgrade()
{
parent::upgrade();
Expand All @@ -107,12 +87,16 @@ public function upgrade()

private function installUserGroups()
{
Group::add(
tc('ht7_c5_base-group_name', 'ht7'),
tc('ht7_c5_base-group_name', 'Base Group for ht7 applications.'),
false,
$this->pkg
);
$gName = tc('ht7_c5_base-group_name', 'ht7');

if (!is_object(Group::getByName($gName))) {
Group::add(
$gName,
tc('ht7_c5_base-group_name', 'Base Group for ht7 applications.'),
false,
$this->pkg
);
}
}

/**
Expand Down

0 comments on commit 1c7a5d3

Please sign in to comment.