Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mahara
mahara
Commits
d3af6bc0
Commit
d3af6bc0
authored
Oct 07, 2019
by
Robert Lyon
Committed by
Gerrit Code Review
Oct 07, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Bug 1844838: Show more versioning info on site info block"
parents
68facdda
22a6111e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
25 deletions
+68
-25
htdocs/lang/en.utf8/admin.php
htdocs/lang/en.utf8/admin.php
+5
-2
htdocs/lib/mahara.php
htdocs/lib/mahara.php
+28
-21
htdocs/lib/statistics.php
htdocs/lib/statistics.php
+18
-1
htdocs/lib/upgrade.php
htdocs/lib/upgrade.php
+1
-0
htdocs/theme/raw/templates/admin/users/stats.tpl
htdocs/theme/raw/templates/admin/users/stats.tpl
+16
-1
No files found.
htdocs/lang/en.utf8/admin.php
View file @
d3af6bc0
...
...
@@ -323,8 +323,11 @@ $string['statsmaxquotaused1'] = 'Has used about %s of disk quota<br>(<a href="%s
$string
[
'groupcountsbytype'
]
=
'Number of groups by group type'
;
$string
[
'groupcountsbyjointype'
]
=
'Number of groups by access type'
;
$string
[
'blockcountsbytype'
]
=
'Most frequently used blocks in portfolio pages'
;
$string
[
'uptodate'
]
=
'up to date'
;
$string
[
'latestversionis'
]
=
'latest version is <a href="%s">%s</a>'
;
$string
[
'uptodate'
]
=
'Your local codebase is up to date with Mahara core.'
;
$string
[
'latestversionis'
]
=
'Most recent major release: <a href="%s">%s</a>'
;
$string
[
'latestbranchversionis'
]
=
'Latest minor version of this release: <a href="%s">%s</a>'
;
$string
[
'versionnotinsupport'
]
=
'%s is out of support.'
;
$string
[
'versionnotinsupportdev'
]
=
'Development version not in support'
;
$string
[
'viewsbytype'
]
=
'Pages by type'
;
$string
[
'institutionloginstabletitle'
]
=
'Active institutions'
;
$string
[
'institutionloginstablesubtitle'
]
=
'For %s - %s'
;
...
...
htdocs/lib/mahara.php
View file @
d3af6bc0
...
...
@@ -4426,38 +4426,45 @@ function cron_clean_internal_activity_notifications() {
* Cronjob to check Launchpad for the latest Mahara version
*/
function
cron_check_for_updates
()
{
$url
=
'https://mahara.org/local/versions.php'
;
$request
=
array
(
CURLOPT_URL
=>
'https://launchpad.net/mahara/+download'
,
CURLOPT_URL
=>
$url
,
);
$result
=
mahara_http_request
(
$request
);
if
(
!
empty
(
$result
->
errno
))
{
log_debug
(
'Could not
retrieve launchpad download page
'
);
if
(
!
empty
(
$result
->
errno
)
||
$result
->
info
[
'http_code'
]
!=
'200'
)
{
log_debug
(
'Could not
access Mahara.org for versioning information.
'
);
return
;
}
$page
=
new
DOMDocument
();
libxml_use_internal_errors
(
true
);
$success
=
$page
->
loadHTML
(
$result
->
data
);
libxml_use_internal_errors
(
false
);
if
(
!
$success
)
{
log_debug
(
'Error parsing launchpad download page'
);
$data
=
json_decode
(
$result
->
data
);
if
(
$data
->
returnCode
==
1
)
{
log_debug
(
'Could not retrieve Mahara versions information file from Mahara.org'
);
return
;
}
$xpath
=
new
DOMXPath
(
$page
);
$query
=
'//div[starts-with(@id,"release-information-")]'
;
$elements
=
$xpath
->
query
(
$query
);
$versions
=
array
();
foreach
(
$elements
as
$e
)
{
if
(
preg_match
(
'/^release-information-(\d+)-(\d+)-(\d+)$/'
,
$e
->
getAttribute
(
'id'
),
$match
))
{
$versions
[]
=
"
$match[1].$match[2].$match[3]
"
;
}
$versions
=
$data
->
message
->
versions
;
// Lets record the needed info locally as the cron only fetches the info once a day
$latestmajorversion
=
max
(
array_keys
((
array
)
$versions
));
$latestversion
=
$latestmajorversion
.
'.'
.
$versions
->
$latestmajorversion
->
latest
;
set_config
(
'latest_version'
,
$latestversion
);
if
(
preg_match
(
'/^(\d+)\.(\d+)\.(\d+).*?$/'
,
get_config
(
'release'
),
$match
))
{
$currentmajorversion
=
$match
[
1
]
.
'.'
.
$match
[
2
];
$latestseriesversion
=
$currentmajorversion
.
'.'
.
$versions
->
$currentmajorversion
->
latest
;
set_config
(
'latest_branch_version'
,
$latestseriesversion
);
}
else
{
set_config
(
'latest_branch_version'
,
''
);
}
if
(
!
empty
(
$versions
))
{
usort
(
$versions
,
'strnatcmp'
);
set_config
(
'latest_version'
,
end
(
$versions
));
$supported
=
array
();
foreach
(
$versions
as
$k
=>
$v
)
{
$insupport
=
filter_var
(
$v
->
supported
,
FILTER_VALIDATE_BOOLEAN
);
if
(
$insupport
)
{
$supported
[]
=
$k
;
}
}
set_config
(
'supported_versions'
,
implode
(
','
,
$supported
));
}
/**
...
...
htdocs/lib/statistics.php
View file @
d3af6bc0
...
...
@@ -72,13 +72,30 @@ function site_statistics($full=false) {
if
(
$latestversion
=
get_config
(
'latest_version'
))
{
$data
[
'latest_version'
]
=
$latestversion
;
if
(
$data
[
'release'
]
==
$latestversion
)
{
$data
[
'
strlatestversion
'
]
=
get_string
(
'uptodate'
,
'admin'
);
$data
[
'
uptodate
'
]
=
get_string
(
'uptodate'
,
'admin'
);
}
else
{
$download_page
=
'https://launchpad.net/mahara/+download'
;
$data
[
'strlatestversion'
]
=
get_string
(
'latestversionis'
,
'admin'
,
$download_page
,
$latestversion
);
}
}
if
(
$branchlatest
=
get_config
(
'latest_branch_version'
))
{
if
(
$data
[
'release'
]
!=
$branchlatest
)
{
$download_page
=
'https://launchpad.net/mahara/+milestone/'
.
$branchlatest
;
$data
[
'strlatestbranchversion'
]
=
get_string
(
'latestbranchversionis'
,
'admin'
,
$download_page
,
$branchlatest
);
}
}
if
(
$insupport
=
get_config
(
'supported_versions'
))
{
$insupport
=
explode
(
','
,
$insupport
);
if
(
!
in_array
(
get_config
(
'series'
),
$insupport
))
{
if
(
preg_match
(
'/dev$/'
,
$data
[
'release'
]))
{
$data
[
'strnotinsupport'
]
=
get_string
(
'versionnotinsupportdev'
,
'admin'
);
}
else
{
$data
[
'strnotinsupport'
]
=
get_string
(
'versionnotinsupport'
,
'admin'
,
get_config
(
'series'
));
}
}
}
if
(
$full
)
{
// Add the other overall graphs here
...
...
htdocs/lib/upgrade.php
View file @
d3af6bc0
...
...
@@ -380,6 +380,7 @@ function upgrade_core($upgrade) {
set_config
(
'release'
,
$upgrade
->
torelease
);
set_config
(
'series'
,
$upgrade
->
toseries
);
bump_cache_version
();
cron_check_for_updates
();
if
(
!
empty
(
$upgrade
->
install
))
{
core_postinst
();
...
...
htdocs/theme/raw/templates/admin/users/stats.tpl
View file @
d3af6bc0
...
...
@@ -43,8 +43,23 @@
{
if
$showall
}
<tr>
<th>
{
str
tag
=
maharaversion
section
=
admin
}
</th>
<td>
{
$institutiondata.release
}
{
if
$institutiondata.strlatestversion
}
(
{
$institutiondata.strlatestversion
|
clean_html
|
safe
}
)
{/
if
}
</td>
<td>
{
$institutiondata.release
}
</td>
</tr>
{
if
$institutiondata.strlatestbranchversion
||
$institutiondata.strnotinsupport
||
$institutiondata.strlatestversion
||
$institutiondata.uptodate
}
<tr>
<td
colspan=
"2"
>
{
if
$institutiondata.uptodate
}
{
$institutiondata.uptodate
}
{
else
}
<ul>
{
if
$institutiondata.strlatestbranchversion
}
<li>
{
$institutiondata.strlatestbranchversion
|
clean_html
|
safe
}
</li>
{/
if
}
{
if
$institutiondata.strnotinsupport
}
<li><span
class=
"text-danger"
>
{
$institutiondata.strnotinsupport
}
</span></li>
{/
if
}
{
if
$institutiondata.strlatestversion
}
<li>
{
$institutiondata.strlatestversion
|
clean_html
|
safe
}
</li>
{/
if
}
</ul>
{/
if
}
</td>
</tr>
{/
if
}
<tr>
<th>
{
str
tag
=
Cron
section
=
admin
}
</th>
<td>
{
if
$institutiondata.cronrunning
}{
str
tag
=
runningnormally
section
=
admin
}{
else
}
...
...
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