/ls1-module-updatecenter

Update lemonstand modules from public repositories (GitHub)

Primary LanguagePHP

Update Center Module

Lemonstand Version 1

Update modules from GitHub using the backend `Modules & Updates' tool!

This module also allows you to continue to receive lemonstand marketplace updates even if you have updated your core modules beyond Lemonstand's last version release.

Install

Install through the lemonstand market place: https://v1.lemonstand.com/marketplace/module/updatecenter/

Or Manual Install:

Core Patch

The lemonstand module located at /modules/core is no longer receiving updates from Lemonstand. In order to use this module the core module requires a patch. This patch replaces three files:

It adds new trigger events to Core_UpdateManager, a new function to the zip helper and upgrades to the latest PclZip library. If you have made your own edits to these files since the last official Lemonstand release you can manually compare/update them.

GitHub Repository Updates

Update one or more versioned modules in the /modules/ directory from public and private GitHub releases.

Other Repository Support

Drivers for other repositories can be added on request. Contributions welcome via: https://github.com/damanic/ls1-module-updatecenter

Repository Config

The update center can be pointed to a public repository for each module on the system by a config file. Config files are located in /modules/updatecenter/repositories/

Out of the box a fully functional repo config file is available for selection via {youradminurl}/updatecenter/setup/.

Selecting this config file will present a list of updates available from https://github.com/damanic/. These include maintenance/bugfix repos for core modules no longer supported by lemonstand.

You can view the config at /modules/updatecenter/repositories/damanic/info.php. Do not edit this file as it may be overwritten on future updates to this module. You can however copy it to a new config file and extend/edit it as you like.

Adding Custom Repository Config Files

Copy the contents of /modules/updatecenter/repositories/damanic/info.php to /modules/updatecenter/repositories/{yourfolder}/info.php. Edit the name, description and repositories data. Once saved it will be available for selection from {youradminurl}/updatecenter/setup/. Each config file you add must reside in its own folder.

Included Config File


	$repository_info = array(
		'name'=>'Core Module Updates | github:damanic',
		'description'=>'Bugfixes and new event additions to core modules no longer updated by lemonstand (cms,core,etc). Plus updates to the updatecenter module',

		'repositories' => array(
			array(
				'source' =>	'github',
				'modules' => array(
					'core' => array(
						'owner' => 'damanic',
						'repo' => 'ls1-module-core',
						'default_allow_update' => true,
						'view_info_url' => 'https://github.com/damanic/ls1-module-core/blob/master/readme.md',
						'view_releases_url' => 'https://github.com/damanic/ls1-module-core/releases',
					),
					'cms' => array(
						'owner' => 'damanic',
						'repo' => 'ls1-module-cms',
						'default_allow_update' => false,
						'view_info_url' => 'https://github.com/damanic/ls1-module-cms/blob/master/readme.md',
						'view_releases_url' => 'https://github.com/damanic/ls1-module-cms/releases',
					),
					'updatecenter' => array(
						'owner' => 'damanic',
						'repo' => 'ls1-module-updatecenter',
						'default_allow_update' => true,
						'view_info_url' => 'https://github.com/damanic/ls1-module-updatecenter/blob/master/readme.md',
						'view_releases_url' => 'https://github.com/damanic/ls1-module-updatecenter/releases',
					),
					'backend' => array(
						'owner' => 'damanic',
						'repo' => 'ls1-module-backend',
						'default_allow_update' => false,
						'view_info_url' => 'https://github.com/damanic/ls1-module-backend/blob/master/readme.md',
						'view_releases_url' => 'https://github.com/damanic/ls1-module-backend/releases',
					),
					'shop' => array(
						'owner' => 'damanic',
						'repo' => 'ls1-module-backend',
						'default_allow_update' => false,
						'view_info_url' => 'https://github.com/damanic/ls1-module-shop/blob/master/readme.md',
						'view_releases_url' => 'https://github.com/damanic/ls1-module-shop/releases',
					),
				)
			)
		),

	);

	

Your GitHub Repo

If you are adding your own repo as a source to update a module there are a few things you need to know:

  • Make sure your module directory structure is compatible with lemonstands module requirements. The /updates/version.dat MUST be present in the repository in order for the update to succeed.
  • Lemonstand will update from the latest 'release' issued by your repository. See: https://help.github.com/articles/creating-releases/
  • If you would like to update a development install with the latest source from github (pre release) you can set up a 'bleeding edge' config file. See example below

Example 'Bleeding Edge' Config file


	$repository_info = array(
		'name'=>'Bleeding Edge Updates | github:damanic',
		'description'=>'Bleeding Edge Updates for damanic repos',

		'repositories' => array(
			array(
				'source' =>	'github',
				'modules' => array(
					'core' => array(
						'owner' => 'damanic',
						'repo' => 'ls1-module-core',
						edge_updates' => array(
                        	'branch' => 'master',
                        ),
					),
					'cms' => array(
						'owner' => 'damanic',
						'repo' => 'ls1-module-cms',
						'edge_updates' => array(
                        	'owner' => 'you',
                        	'repo' => 'your-repo',
                        	'branch' => 'master',
                        ),
					)
				)
			)

		),

	);
	

As you can see you can use 'edge_updates' to fetch from a different branch on the same repository or a branch on another owners repository.

NOTE: Because a branch has no release version no updates will be found, so to apply the edge update from a branch you need to use 'Force Update'.

GitHub Authentication

To avoid API request limitations and access private repositories you can add authentication tokens.

To generate a personal access token:

  • go to your github.com account profile/settings (https://github.com/settings/tokens).
  • create your token, assign its permissions and add it on the update centers settings screen : {youradminurl}/updatecenter/setup/

Once added on the backend the token will be used on all your API requests by default. If you would like to override the key for a specific repo you can do so using the repo config file.

Example:


	$repository_info = array(
		'name'=>'Private Repo Updates',
		'description'=>'Gimmie private repos',

		'repositories' => array(
			array(
				'source' =>	'github',
				'modules' => array(
					'xtest' => array(
						'owner' => 'you',
						'repo' => 'my-private-repo',
						'auth' => array(
							'token' => {YOURACCESSTOKEN}
						}
					),
					'xreports' => array(
						'owner' => 'mywork',
						'repo' => 'company-repo',
						'auth' => array(
                        	'token' => {WORKACCESSTOKEN}
                        }
					)
				)
			)

		),

	);
	

Limitations

The repo updates will only update modules in the /module/ directory. It does not support updates to the framework outside of this directory.

Update Blocking

  • Set from 'block' tab in : {youradminurl}/updatecenter/setup/
  • Select any module that you would like the update center to block from receiving updates. This applies to both repo and the lemonstand update delivery service.

Forced Updates

Using the forced update button when no updates are found forces lemonstand to re-download the modules and overwite them:

  • First all the final/latest releases from the lemonstand update service are extracted to the modules directory.
  • Second all the latest releases from your repositories are extracted to the modules directory.

Before running a forced update you should consider blocking updates to any lemonstand module that you have changed locally and not assigned to a repository - otherwise your changes may be overwritten.

Restoring Core Lemonstand Versions

If at some point you want to revert back to the last set of module releases from Lemonstand you can do this by removing the repository config selection in {youradminurl}/updatecenter/setup/ and then doing a forced update. Note: This will overwrite all code changes made to your core modules AND the underlying Lemonstand (phproad) framework. If repository updates made any changes to the database schema or added any files, they will not be rolled back or removed.

Common Issues

Update process successfully completed but update did not apply

If a module has been added to your modules directory via FTP or not via lemonstands update manager, the files may not be PHP writable. Any file in a module directory that is not PHP writable will not be updated. Be sure to CHMOD the files and folders in your /modules directory so that it is PHP writable after any manual file upload.

No Updates available, when there are

This can be caused by a communication error. GitHub will deny connections if too many requests are made without a personal access token set. Go to system -> settings -> repo updates -> github (tab) to set your access token. Otherwise check your log file (as set by $CONFIG['TRACE_LOG']['INFO']) for errors.