migrate to php 7

Bu işleme şunda yer alıyor:
Adrian Malacoda 2017-10-21 23:35:43 -05:00
ebeveyn fc49ccb695
işleme 8b2e8e318e
4 değiştirilmiş dosya ile 40 ekleme ve 40 silme

Dosyayı Görüntüle

@ -1,6 +1,6 @@
FROM debian:stable
RUN apt-get -y update && apt-get -y install nginx php5-fpm php5-mysql php-apc supervisor python-pip mysql-client imagemagick curl wget
RUN apt-get -y update && apt-get -y install nginx php-fpm php-mysql php-apcu php-mbstring php-xml supervisor python-pip mysql-client imagemagick curl wget
RUN pip install supervisor-stdout
ENV MW_VERSION REL1_29
@ -23,14 +23,14 @@ RUN cd /usr/src && curl -sS https://getcomposer.org/installer | php -- --install
# Clone mediawiki and SMF source into temp directory, install and then copy over to application dir
RUN cd /tmp && wget $MW_SOURCE && tar -xvf mediawiki-*.tar.gz && \
cp -Rv mediawiki-*/* $WIKI_SOURCE && rm -rf mediawiki-* && \
mkdir smf && cp smf && wget $SMF_SOURCE && tar -xvf $SMF_SOURCE && \
rm -rf Settings.php attachments *.tar.gz && cp -Rv * $FORUMS_SOURCE
mkdir smf && cd smf && wget $SMF_SOURCE && tar -xvf smf_*.tar.gz && \
rm -rf Settings.php attachments smf_*.tar.gz && cp -Rv * $FORUMS_SOURCE
RUN ln -sf /configuration/supervisord.conf /etc/supervisor/supervisord.conf && \
ln -sf /configuration/nginx.conf /etc/nginx/nginx.conf && \
ln -sf /configuration/php-fpm.conf /etc/php5/fpm/php-fpm.conf && \
ln -sf /configuration/php-fpm-pool.conf /etc/php5/fpm/pool.d/www.conf && \
ln -sf /configuration/php.ini /etc/php5/fpm/php.ini
ln -sf /configuration/php-fpm.conf /etc/php/7.0/fpm/php-fpm.conf && \
ln -sf /configuration/php-fpm-pool.conf /etc/php/7.0/fpm/pool.d/www.conf && \
ln -sf /configuration/php.ini /etc/php/7.0/fpm/php.ini
RUN chown -R www-data:www-data /application

Dosyayı Görüntüle

@ -140,7 +140,7 @@
$maintenance = 0;
// This is just because SMF in general hates magic quotes at runtime.
@set_magic_quotes_runtime(0);
//@set_magic_quotes_runtime(0);
// Hopefully the forum is in the same place as this script.
require_once(dirname(__FILE__) . '/Settings.php');
@ -152,18 +152,18 @@ if ($maintenance != 2)
{
// Ignore connection errors, because this is just an API file.
if (empty($db_persist))
$smf_connection = @mysql_connect($db_server, $db_user, $db_passwd);
$smf_connection = @mysqli_connect($db_server, $db_user, $db_passwd);
else
$smf_connection = @mysql_pconnect($db_server, $db_user, $db_passwd);
$smf_connection = @mysqli_pconnect($db_server, $db_user, $db_passwd);
//$db_prefix = '`' . $db_name . '`.' . $db_prefix;
mysql_select_db($db_name);
mysqli_select_db($db_name);
$request = smf_query("
SELECT `variable`, `value`
FROM {$db_prefix}settings",__FILE__,__LINE__);
$smf_settings = array();
while ($row = @mysql_fetch_row($request))
while ($row = @mysqli_fetch_row($request))
$smf_settings[$row[0]] = $row[1];
mysql_free_result($request);
mysqli_free_result($request);
}
// Load stuff from the Settings.php file into $smf_settings.
@ -196,8 +196,8 @@ function smf_setLoginCookie($cookie_length, $id, $password = '', $encrypted = tr
FROM $smf_settings[db_prefix]members
WHERE member_name = '$username'
LIMIT 1", __FILE__, __LINE__);
list ($id) = mysql_fetch_row($result);
mysql_free_result($result);
list ($id) = mysqli_fetch_row($result);
mysqli_free_result($result);
// It wasn't found, after all?
if (empty($id))
@ -222,8 +222,8 @@ function smf_setLoginCookie($cookie_length, $id, $password = '', $encrypted = tr
FROM $smf_settings[db_prefix]members
WHERE id_member = '" . (int) $id . "'
LIMIT 1", __FILE__, __LINE__);
list ($username, $salt) = mysql_fetch_row($result);
mysql_free_result($result);
list ($username, $salt) = mysqli_fetch_row($result);
mysqli_free_result($result);
if (empty($username))
return false;
@ -319,10 +319,10 @@ function smf_authenticateUser()
LIMIT 1", __FILE__, __LINE__);
// Did we find 'im? If not, junk it.
if (mysql_num_rows($request) != 0)
if (mysqli_num_rows($request) != 0)
{
// The base settings array.
$smf_user_info += mysql_fetch_assoc($request);
$smf_user_info += mysqli_fetch_assoc($request);
if (strlen($password) == 40)
$check = sha1($smf_user_info['passwd'] . $smf_user_info['password_salt']) == $password;
@ -334,7 +334,7 @@ function smf_authenticateUser()
}
else
$ID_MEMBER = 0;
mysql_free_result($request);
mysqli_free_result($request);
}
if (empty($ID_MEMBER))
@ -502,8 +502,8 @@ function smf_isOnline($user)
LEFT JOIN $smf_settings[db_prefix]members AS mem ON (mem.id_member = lo.id_member)" : '') . "
WHERE lo.id_member = " . (int) $user . (!is_integer($user) ? " OR mem.member_name = '$user'" : '') . "
LIMIT 1", __FILE__, __LINE__);
$return = mysql_num_rows($result) != 0;
mysql_free_result($result);
$return = mysqli_num_rows($result) != 0;
mysqli_free_result($result);
return $return;
}
@ -563,10 +563,10 @@ function smf_query($string, $file, $line)
$smf_settings['db_count'] = @$smf_settings['db_count'] + 1;
$ret = mysql_query($string, $smf_connection);
$ret = mysqli_query($string, $smf_connection);
if ($ret === false)
smf_logError(mysql_error($smf_connection), $file, $line);
smf_logError(mysqli_error($smf_connection), $file, $line);
return $ret;
}
@ -591,14 +591,14 @@ function smf_allowedTo($permission)
WHERE id_group IN (" . implode(', ', $smf_user_info['groups']) . ")", __FILE__, __LINE__);
$removals = array();
$smf_user_info['permissions'] = array();
while ($row = mysql_fetch_assoc($result))
while ($row = mysqli_fetch_assoc($result))
{
if (empty($row['add_deny']))
$removals[] = $row['permission'];
else
$smf_user_info['permissions'][] = $row['permission'];
}
mysql_free_result($result);
mysqli_free_result($result);
// And now we get rid of the removals ;).
if (!empty($smf_settings['permission_enable_deny']))
@ -664,7 +664,7 @@ function smf_loadThemeData($ID_THEME = 0)
AND id_theme" . ($theme == 1 ? ' = 1' : " IN ($theme, 1)"), __FILE__, __LINE__);
// Pick between $smf_settings['theme'] and $smf_user_info['theme'] depending on whose data it is.
$themeData = array(0 => array(), $member => array());
while ($row = mysql_fetch_assoc($result))
while ($row = mysqli_fetch_assoc($result))
{
// If this is the themedir of the default theme, store it.
if (in_array($row['variable'], array('theme_dir', 'theme_url', 'images_url')) && $row['id_theme'] == '1' && empty($row['id_member']))
@ -674,7 +674,7 @@ function smf_loadThemeData($ID_THEME = 0)
if (!isset($themeData[$row['id_member']][$row['variable']]) || $row['id_theme'] != '1')
$themeData[$row['id_member']][$row['variable']] = substr($row['variable'], 0, 5) == 'show_' ? $row['value'] == '1' : $row['value'];
}
mysql_free_result($result);
mysqli_free_result($result);
$smf_settings['theme'] = $themeData[0];
$smf_user_info['theme'] = $themeData[$member];
@ -702,7 +702,7 @@ function smf_loadSession()
@ini_set('session.use_cookies', true);
@ini_set('session.use_only_cookies', false);
@ini_set('arg_separator.output', '&');
// If it's already been started... probably best to skip this.
if ((@ini_get('session.auto_start') == 1 && !empty($smf_settings['databaseSession_enable'])) || session_id() == '')
{
@ -759,8 +759,8 @@ function smf_sessionRead($session_id)
FROM $smf_settings[db_prefix]sessions
WHERE session_id = '" . addslashes($session_id) . "'
LIMIT 1", __FILE__, __LINE__);
list ($sess_data) = mysql_fetch_row($result);
mysql_free_result($result);
list ($sess_data) = mysqli_fetch_row($result);
mysqli_free_result($result);
return $sess_data;
}
@ -780,7 +780,7 @@ function smf_sessionWrite($session_id, $data)
LIMIT 1", __FILE__, __LINE__);
// If that didn't work, try inserting a new one.
if (mysql_affected_rows($smf_connection) == 0)
if (mysqli_affected_rows($smf_connection) == 0)
$result = smf_query("
INSERT IGNORE INTO $smf_settings[db_prefix]sessions
(session_id, data, last_update)
@ -912,4 +912,4 @@ if (!function_exists('sha1'))
}
}
?>
?>

Dosyayı Görüntüle

@ -27,7 +27,7 @@ pid = run/php5-fpm.pid
; Error log file
; Note: the default prefix is /var
; Default Value: log/php-fpm.log
error_log = /var/log/php5-fpm.log
error_log = /var/log/php-fpm.log
; Log level
; Possible Values: alert, error, warning, notice, debug
@ -40,7 +40,7 @@ error_log = /var/log/php5-fpm.log
; Default Value: 0
emergency_restart_threshold = 10
; Interval of time used by emergency_restart_interval to determine when
; Interval of time used by emergency_restart_interval to determine when
; a graceful restart will be initiated. This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
@ -59,7 +59,7 @@ process_control_timeout = 5
daemonize = no
;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;
; Multiple pools of child processes may be started with different listening
@ -69,4 +69,4 @@ daemonize = no
; To configure the pools it is recommended to have one .conf file per
; pool in the following directory:
include=/etc/php5/fpm/pool.d/*.conf
include=/etc/php/7.0/fpm/pool.d/*.conf

Dosyayı Görüntüle

@ -15,13 +15,13 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
[program:php5-fpm]
command=/usr/sbin/php5-fpm -c /etc/php5/fpm
[program:php-fpm]
command=/usr/sbin/php-fpm7.0 -c /etc/php/7.0/fpm
stdout_events_enabled=true
stderr_events_enabled=true
[program:php5-fpm-log]
command=tail -f /var/log/php5-fpm.log
[program:php-fpm-log]
command=tail -f /var/log/php-fpm.log
stdout_events_enabled=true
stderr_events_enabled=true
autorestart=unexpected