Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F2112079
prerequisit.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 18, 1:03 PM
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Nov 20, 1:03 PM (5 h, 50 m)
Engine
blob
Format
Raw Data
Handle
981207
Attached To
rINP In-Portal
prerequisit.php
View Options
<?php
$PreRequisitErrors
=
Array
();
$path
=
$pathtoroot
.
"in-link"
;
$result
=
true
;
if
(!
function_exists
(
'ConvertVersion'
))
{
function
ConvertVersion
(
$version
)
{
$parts
=
explode
(
'.'
,
$version
);
$bin
=
''
;
foreach
(
$parts
as
$part
)
{
$bin
.=
str_pad
(
decbin
(
$part
),
8
,
'0'
,
STR_PAD_LEFT
);
}
$dec
=
bindec
(
$bin
);
return
$dec
;
}
}
//'In-Portal' => '1.1.0',
$min_versions
=
Array
(
'In-Link'
=>
'3.1.0'
,
'In-News'
=>
'1.1.0'
,
'In-Bulletin'
=>
'1.1.0'
,
'In-Commerce'
=>
'1.0.0'
,
);
$conn
=&
GetADODBConnection
();
$query
=
'SELECT * FROM '
.
GetTablePrefix
().
'Modules'
;
$rs
=
$conn
->
Execute
(
$query
);
while
(
$rs
&&
!
$rs
->
EOF
)
{
if
(
isset
(
$min_versions
[
$rs
->
fields
[
'Name'
]]))
{
if
(
ConvertVersion
(
$rs
->
fields
[
'Version'
])
<
ConvertVersion
(
$min_versions
[
$rs
->
fields
[
'Name'
]])
)
{
$PreRequisitErrors
[]
=
'Please upgrade '
.
$rs
->
fields
[
'Name'
].
' to version '
.
$min_versions
[
$rs
->
fields
[
'Name'
]].
' or above'
;
$result
=
false
;
}
}
$rs
->
MoveNext
();
}
if
(
$show_errors
)
{
foreach
(
$PreRequisitErrors
as
$error
)
{
echo
'<b><font color="#FF0000">'
.
$error
.
'</font></b><br />'
;
}
}
?>
Event Timeline
Log In to Comment