Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
b38c2574
Unverified
Commit
b38c2574
authored
Aug 01, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added an AsgardCms class containing the current cms version
parent
95aa9e1d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
49 deletions
+17
-49
AsgardCms.php
Modules/Core/AsgardCms.php
+12
-0
ApplicationVersionViewComposer.php
Modules/Core/Composers/ApplicationVersionViewComposer.php
+2
-49
changelog.yml
Modules/Core/changelog.yml
+3
-0
No files found.
Modules/Core/AsgardCms.php
0 → 100644
View file @
b38c2574
<?php
namespace
Modules\Core
;
class
AsgardCms
{
/**
* The AsgardCms version.
* @var string
*/
const
VERSION
=
'2.5.2'
;
}
Modules/Core/Composers/ApplicationVersionViewComposer.php
View file @
b38c2574
...
...
@@ -2,63 +2,16 @@
namespace
Modules\Core\Composers
;
use
Illuminate\Contracts\Cache\Repository
;
use
Illuminate\Contracts\Filesystem\Filesystem
;
use
Illuminate\Contracts\View\View
;
use
Illuminate\Http\Request
;
use
Modules\Core\AsgardCms
;
class
ApplicationVersionViewComposer
{
/**
* @var Filesystem
*/
private
$filesystem
;
/**
* @var Repository
*/
private
$cache
;
/**
* @var Request
*/
private
$request
;
public
function
__construct
(
Filesystem
$filesystem
,
Repository
$cache
,
Request
$request
)
{
$this
->
filesystem
=
$filesystem
;
$this
->
cache
=
$cache
;
$this
->
request
=
$request
;
}
public
function
compose
(
View
$view
)
{
if
(
app
(
'asgard.onBackend'
)
===
false
)
{
return
;
}
$view
->
with
(
'version'
,
$this
->
getAppVersion
());
}
/**
* @return string
*/
private
function
getAppVersion
()
{
$composerFile
=
$this
->
getComposerFile
();
return
isset
(
$composerFile
->
version
)
?
$composerFile
->
version
:
'1.0'
;
}
/**
* Get the decoded contents from the main composer.json file
* @return object
*/
private
function
getComposerFile
()
{
$appName
=
str_slug
(
config
(
'app.name'
));
$composerFile
=
$this
->
cache
->
remember
(
"app.version.
$appName
"
,
1440
,
function
()
{
return
$this
->
filesystem
->
get
(
'composer.json'
);
});
return
json_decode
(
$composerFile
);
$view
->
with
(
'version'
,
AsgardCms
::
VERSION
);
}
}
Modules/Core/changelog.yml
View file @
b38c2574
url
:
https://github.com/AsgardCms/Platform
versions
:
"
2.x.x@unreleased"
:
added
:
-
Added an <code>AsgardCms</code> class containing the current cms version
"
2.5.2"
:
changed
:
-
Fixing CLI issue not having the translation repository bound
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment