mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
fix install
This commit is contained in:
parent
0857ec5401
commit
81e8020522
|
@ -127,9 +127,9 @@ ALTER TABLE `prefix_blog_user` ADD `user_role` INT( 3 ) NOT NULL ;
|
|||
ALTER TABLE `prefix_blog_user` CHANGE `user_role` `user_role` INT( 3 ) DEFAULT '1';
|
||||
|
||||
ALTER TABLE `prefix_user` CHANGE `user_profile_avatar` `user_profile_avatar` VARCHAR( 250 );
|
||||
ALTER TABLE `prefix_user` DROP `user_profile_avatar_type`;
|
||||
|
||||
ALTER TABLE `prefix_blog` CHANGE `blog_avatar` `blog_avatar` VARCHAR( 250 );
|
||||
ALTER TABLE `prefix_blog` DROP `blog_avatar_type`;
|
||||
|
||||
|
||||
ALTER TABLE `prefix_user` ADD `user_date_topic_last` DATETIME AFTER `user_date_comment_last` ;
|
||||
ALTER TABLE `prefix_user` DROP `user_date_topic_last`;
|
||||
|
|
|
@ -1170,6 +1170,56 @@ class Install {
|
|||
if(!$bResult) $aErrors[] = mysql_error();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Обновляем пути до аватаров и фото у юзеров
|
||||
*/
|
||||
$sTable=$aParams['prefix'].'user';
|
||||
if($aResults = mysql_query("SELECT * FROM {$sTable}")){
|
||||
while($aRow = mysql_fetch_assoc($aResults)) {
|
||||
if ($aRow['user_profile_avatar']==0) {
|
||||
$sSqlUpdate="UPDATE {$sTable} SET user_profile_avatar = NULL WHERE user_id={$aRow['user_id']}";
|
||||
} else {
|
||||
$sAvatarPath=$this->GetPathRootWeb().'/uploads/images/'.$aRow['user_id'].'/avatar_100x100.'.$aRow['user_profile_avatar_type'];
|
||||
$sAvatarPath=mysql_escape_string($sAvatarPath);
|
||||
$sSqlUpdate="UPDATE {$sTable} SET user_profile_avatar = '{$sAvatarPath}' WHERE user_id={$aRow['user_id']}";
|
||||
}
|
||||
if(!mysql_query($sSqlUpdate)) $aErrors[] = mysql_error();
|
||||
|
||||
if ($aRow['user_profile_foto']) {
|
||||
$sAvatarPath=$this->GetPathRootWeb().$aRow['user_profile_foto'];
|
||||
$sAvatarPath=mysql_escape_string($sAvatarPath);
|
||||
$sSqlUpdate="UPDATE {$sTable} SET user_profile_foto = '{$sAvatarPath}' WHERE user_id={$aRow['user_id']}";
|
||||
if(!mysql_query($sSqlUpdate)) $aErrors[] = mysql_error();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Удаляем поле user_profile_avatar_type
|
||||
*/
|
||||
if(!mysql_query("ALTER TABLE `{$sTable}` DROP `user_profile_avatar_type`;")) $aErrors[] = mysql_error();
|
||||
|
||||
/**
|
||||
* Обновляем пути до аватаров у блогов
|
||||
*/
|
||||
$sTable=$aParams['prefix'].'blog';
|
||||
if($aResults = mysql_query("SELECT * FROM {$sTable}")){
|
||||
while($aRow = mysql_fetch_assoc($aResults)) {
|
||||
if ($aRow['blog_avatar']==0) {
|
||||
$sSqlUpdate="UPDATE {$sTable} SET blog_avatar = NULL WHERE blog_id={$aRow['blog_id']}";
|
||||
} else {
|
||||
$sAvatarPath=$this->GetPathRootWeb().'/uploads/images/'.$aRow['user_owner_id'].'/avatar_blog_'.$aRow['blog_url'].'_48x48.'.$aRow['blog_avatar_type'];
|
||||
$sAvatarPath=mysql_escape_string($sAvatarPath);
|
||||
$sSqlUpdate="UPDATE {$sTable} SET blog_avatar = '{$sAvatarPath}' WHERE blog_id={$aRow['blog_id']}";
|
||||
}
|
||||
if(!mysql_query($sSqlUpdate)) $aErrors[] = mysql_error();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Удаляем поле blog_avatar_type
|
||||
*/
|
||||
if(!mysql_query("ALTER TABLE `{$sTable}` DROP `blog_avatar_type`;")) $aErrors[] = mysql_error();
|
||||
|
||||
|
||||
/**
|
||||
* Переводим в одну таблицу vote`ы
|
||||
*/
|
||||
|
@ -1436,8 +1486,16 @@ class Install {
|
|||
*/
|
||||
function SavePath() {
|
||||
$sLocalConfigFile = $this->sConfigDir.'/'.self::LOCAL_CONFIG_FILE_NAME;
|
||||
$this->SaveConfig('path.root.web',rtrim('http://'.$_SERVER['HTTP_HOST'],'/'), $sLocalConfigFile);
|
||||
$this->SaveConfig('path.root.server', rtrim($_SERVER['DOCUMENT_ROOT'],'/'), $sLocalConfigFile);
|
||||
$this->SaveConfig('path.root.web',$this->GetPathRootWeb(), $sLocalConfigFile);
|
||||
$this->SaveConfig('path.root.server', $this->GetPathRootServer(), $sLocalConfigFile);
|
||||
}
|
||||
|
||||
function GetPathRootWeb() {
|
||||
return rtrim('http://'.$_SERVER['HTTP_HOST'],'/');
|
||||
}
|
||||
|
||||
function GetPathRootServer() {
|
||||
return rtrim($_SERVER['DOCUMENT_ROOT'],'/');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue