如何使用drush site-upgrade升级Drupal 6到Drupal 7

ㄚ琪琪的家终于复归了,但除了保存许多珍贵资料外,似乎还不能引人入胜,所以我们想改一下版型,却发现很多都是需要Drupal 7的才可以安装,一不做二不休,既然都复归,就也来个升级吧。

[adsense][/adsense]

这次的升级有了drush这个神兵利器,看来比较人性化了,否则Drupal有很大的进入障碍。一般都是用来小升级,要大升级的话,可能就得注意一下了,ㄚ琪这次参考的资料是Upgrade Drupal 6 to Drupal 7 using Drush site-upgrade,我们将它翻成中文,而且调整为适合我们的升级方式,这个升级的步骤很可能会因为每个人的Drupal 6安装不同而产生很多的问题,像ㄚ琪这次在升级就碰到很多的问题,不过秉持着ㄚ琪MySQL多年的造诣,还是克服了升级的障碍,至于如何升级且听我的分享。

当然我们要用drush的原因就是可以大量节省你升级Drupal 6的核心跟模组到Drupal7的核心跟模组,当然很可能你在drush site-upgrade后,你的网站会不能用,不过如果发生的话,接下来你还是可以搜寻手动升级模组的方法来做。

安装最新版的Drush

2013-10-04_153551

 

上面的安装方式室比较正式的,但因为我们使用的是Ubuntu系统,所以有更简单的安装方式:

pear channel-discover pear.drush.org

pear install drush/drush

drush

假如没有问题,drush可以列出所有的功能选项,这样就成功了第一步。

设定 drush aliases

现在我们需要告诉drush新的网站位置,drush不会覆盖旧的网站,所以就算你升级失败了,也不碍事的。现在要编辑aliases.drushrc.php这个档。

vi /usr/local/share/drush/aliases.drushrc.php

注意,在Ubuntu是这样:

vim /usr/share/php/drush/aliases.drushrc.php

因为我喜欢用vim,所以编辑的程式因人而异。

将下面的程式码依需要复制贴上修改:

$aliases['newdrupalsite'] = array(
  'uri'  => 'localhost',
  'root' => '/absolute/path/to/your/new/drupal/site', // 这必须是完整的路径,不是相对路径喔
  'db-url' => 'mysql://DBUSER:DBPASS@localhost/DBNAME', //这是你新的资料库名称,还有帐号跟密码,这是用来升级的
);

接着我们到旧网站的路径去:

cd /location/of/drupal6/site
drush site-upgrade @newdrupalsite

好了,现在就照着指示做吧,这需要花一些时间,而且可能顺利,也可能荆棘重重。

嗯,马上就有问题了,你有可能缺少drush_sup这个专案,所以现在就下载吧:

drush dl drush_sup

再重新升级一次:

A Drupal site exists at the destination. What would you like to do?
[0] : Cancel
[1] : Re-use the existing code: re-import the database from the source
site and update core and contrib modules again.
[2] : Delete the existing target: start over from the beginning.

出现提示讯息,我是输入1

Gathering information about core and contrib modules…

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 1

1. Check on the Drupal 7 status of your contributed and custom modules
and themes. See http://drupal.org/node/948216 for information on
upgrading contributed modules and themes. See
http://drupal.org/node/895314 for a list of modules that have been moved
into core for Drupal 7, and instructions on how to update them. See
http://drupal.org/update/modules for information on how to update your
custom modules, and http://drupal.org/update/theme for custom themes.

You may decide at this point that you cannot upgrade your site, because
needed modules or themes are not ready for Drupal 7.

There are no enabled contrib extensions; Drush will upgrade Drupal core.

Please review the upgread readiness report. You may want to uninstall modules that are not ready to upgrade yet.
[0] : Cancel
[1] : Begin upgrade

出现提示讯息后,我继续选1

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 2

2. Update to the latest available version of Drupal 6.x (if your
current version is Drupal 5.x, you have to upgrade to 6.x first). If you
need to update, download Drupal 6.x and follow the instructions in its
UPGRADE.txt. This document only applies for upgrades from 6.x to 7.x.

You must also insure that all of your contrib modules are up to date!

Drupal core is up-to-date; version 6.28 installed.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 3

3. Log in as user ID 1 (the site maintenance user).

You will not need to log in if Drush is used to perform all upgrade
steps for you.

Skipping optional step.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 4

4. Go to Administer > Site configuration > Site maintenance. Select
“Off-line” and save the configuration.

When Drush does the steps of your site upgrade, it always modifies the
working copy of your site; the original site is left unchanged. You may
wish to take your site off-line anyway.

Skipping optional step.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 5

5. Go to Administer > Site building > Themes. Enable “Garland” and
select it as the default theme.

Drush will set the administrative theme to “Garland” in the target site
without affecting the source site.

Skipping optional step.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 6

6. Go to Administer > Site building > Modules. Disable all modules that
are not listed under “Core – required” or “Core – optional”. It is
possible that some modules cannot be disabled, because others depend on
them. Repeat this step until all non-core modules are disabled.

If you know that you will not re-enable some modules for Drupal 7.x and
you no longer need their data, then you can uninstall them under the
Uninstall tab after disabling them.

Drush will automatically disable all non-core modules in the target site
without affecting the source site. You may disable or uninstall contrib
modules now if you wish; any that you do not do now will be disabled by
Drush after Step 12.

Skipping optional step.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 7

7. On the command line or in your FTP client, remove the file

sites/default/default.settings.php

Drush will remove default.settings.php from the target site later, after
Step 12. You may remove it from the source sit now if you wish, but
doing so is unnecessary.

Skipping optional step.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 8

8. Remove all old core files and directories, except for the ‘sites’
directory and any custom files you added elsewhere.

If you made modifications to files like .htaccess or robots.txt, you
will need to re-apply them from your backup, after the new files are in
place.

Drush will create your upgraded site in a new location; it is not
necessary to remove any core files from the source site.

Skipping optional step.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 9

9. If you uninstalled any modules, remove them from the
sites/all/modules and other sites/*/modules directories. Leave other
modules in place, even though they are incompatible with Drupal 7.x.

Drush will create your upgraded site in a new location; it is not
necessary to remove any contrib module files from the source site.

Skipping optional step.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 10

10. Download the latest Drupal 7.x release from http://drupal.org to a
directory outside of your web root. Extract the archive and copy the
files into your Drupal directory.

On a typical Unix/Linux command line, use the following commands to
download and extract:

wget http://drupal.org/files/projects/drupal-x.y.tar.gz tar -zxvf
drupal-x.y.tar.gz

This creates a new directory drupal-x.y/ containing all Drupal files and
directories. Copy the files into your Drupal installation directory:

cp -R drupal-x.y/* drupal-x.y/.htaccess /path/to/your/installation

If you do not have command line access to your server, download the
archive from http://drupal.org using your web browser, extract it, and
then use an FTP client to upload the files to your web root.

Drush will automatically do this step now.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 11

11. Re-apply any modifications to files such as .htaccess or
robots.txt.

If you had no modifications to .htaccess or robots.txt, you don’t need
to do anything here.

Drush cannot do this step; you must perform it manually.

What would you like to do?
[0] : Cancel
[1] : I will do this step manually.
[2] : Skip this step.

很顺利的进行到步骤11了,提示讯息出现后我输入1

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 12

12. Make your settings.php file writeable, so that the update process
can convert it to the format of Drupal 7.x. settings.php is usually
located in

sites/default/settings.php

Note that Drush will instead *copy* your settings.php file to its new
location. The copy is made writable, but the original may remain
write-protected.

Drush will automatically do this step now.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 12-a

12-a. Drush-specific step: Drush will now do steps 5 and 6 of
UPGRADE.txt, and set the site theme to Garland and disable all contrib
modules. Before it does this, it makes a copy of your database, and does
all modifications on the *copy*, leaving your source site unchanged.
Drush will also uninstall all modules specified via the –uninstall
option at this time.

Drush will automatically do this step now.
No tables to drop. [ok]

You will destroy data in drupal7 and replace with data from drupal.

You might want to make a backup first, using the sql-dump command.

Do you really want to continue? (y/n): y
ERROR 1 (HY000) at line 25: Can’t create/write to file ‘/var/lib/mysql/新的资料库名称/access.MYI’ (Errcode: 2)

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 12-b

12-b. Drush-specific step: Drush will now do step 7 of UPGRADE.txt, and
remove sites/default/default.settings.php from the target site.

Drush will automatically do this step now.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 13

13. Run update.php by visiting http://www.example.com/update.php
(replace www.example.com with your domain name). This will update the
core database tables.

If you are unable to access update.php do the following:

– Open settings.php with a text editor.

– Find the line that says: $update_free_access = FALSE;

– Change it into: $update_free_access = TRUE;

– Once the upgrade is done, $update_free_access must be reverted to
FALSE.

Note that Drush will copy your database and run updatedb on the copy.
The source database remains unchanged.

Drush will automatically do this step now.
<h1>Additional uncaught exception thrown while handling exception.</h1><h2>Original</h2><p>PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &amp;#039;drupal7.system&amp;#039; doesn&amp;#039;t exist: SELECT name, schema_version FROM {system} WHERE type = :type; Array
(
[:type] =&amp;gt; module
)
in drupal_get_installed_schema_version() (line 155 of /新的网站路径/includes/install.inc).</p><h2>Additional</h2><p>PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &amp;#039;drupal7.system&amp;#039; doesn&amp;#039;t exist: SELECT * FROM {system} WHERE type = &amp;#039;theme&amp;#039; OR (type = &amp;#039;module&amp;#039; AND status = 1) ORDER BY weight ASC, name ASC; Array
(
)
in system_list() (line 165 of /新的网站路径/includes/module.inc).</p><hr />Drush command terminated abnormally due to an unrecoverable error.[error]
updatedb failed for core [error]

够诡异吧,我想可能只有我会发生这个问题,我的空间不够了,所以发生这样的惨剧,马上找颗硬碟来挂,重新升级。

.
.
.

这次碰到这样的问题:

WD php: PDOException: SQLSTATE[42000]: Syntax error or access [error]
violation: 1071 Specified key was too long; max key length is 1000
bytes: ALTER TABLE {sessions} ADD PRIMARY KEY (`sid`, `ssid`);
Array
(
)
in db_add_primary_key() (line 2891 of
/新的网站路径/includes/database/database.inc).
Drush command terminated abnormally due to an unrecoverable error.[error]
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes: ALTER TABLE {sessions} ADD PRIMARY KEY (`sid`, `ssid`); Array
(
)
in db_add_primary_key() (line 2891 of /新的网站路径/includes/database/database.inc).
updatedb failed for core [error]

这一类1071 Specified key was too long; max key length is 1000错误的讯息,好像超多人会有的,不过我看都没有是sessions这个资料表的问题,后来从MySQL的错误观点来看,我从新回去看Drupal6跟Drupal7这两个资料库,发现Drupal 7多加了ssid这个栏位,而且把sid跟ssid当成主键,这样就有问题了,外国人可能不会有这个问题,但是华人用可能问题就大了,因为ㄚ琪原本的sid栏位的语系用utf8_general_ci,升级的时候ssid也会设成utf8_general_ci这样的语系,sid原本是varchar(255),所以升级的时候,会多加ssid栏位,varchar(128),然后再改成主键,这样子就会超过1000bytes,(255+128)*3 = 1149,所以我将sid的语系改成latin1_general_ci,再重新升级一次。

Cannot use a scalar value as an array locale.module:724             [warning]

.
.
.

都是这类的警告,不过不碍事。

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 14

14. Backup your database after the core upgrade has run.

Drush will automatically do this step now.
Making backup: ‘Upgraded Core’ in /root/.drush/cache/self-d6-to-drupal7-d7/progress_backups/upgraded-core.tar

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
UPGRADE.txt Major Upgrade Step 15

15. Replace and update your non-core modules and themes, following the
procedures at http://drupal.org/node/948216

Drush will walk through these instructions for each module. Note that all
of the new modules will be downloaded up-front now; they will be moved
into place later.
Invalid argument supplied for foreach() upgrade.drush.inc:834 [warning]

There are no more modules to be upgraded.
[0] : Cancel
[1] : All done; finish upgrade

提示讯息后按1

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Upgrading Contrib Modules from Drupal 6 to Drupal 7 Finish Up

If you have a Drupal 7 version of the theme you were using for Drupal 6,
place it in sites/all/themes/ and reenable it.

Drush cannot do this step; you must perform it manually.

What would you like to do?
[0] : Cancel
[1] : I will do this step manually.

我再按1

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Post-upgrade Step A

A. Copy files directory from the source site to the upgrade site.

What would you like to do?
[0] : Cancel
[1] : Do it for me.
[2] : I will do this step manually.

这次我还是选1

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Post-upgrade Step B

B. Enable the core module content_migrate.

What would you like to do?
[0] : Cancel
[1] : Enable content migrate and show available migrations.
[2] : Do not enable the content migrate module.

我选2,这跟原文说的‘Also when asked “Enable the core module content_migrate.” select “Do not enable the content migrate module”.’是一样的。

我没有碰到原文的问题,所以我就不转贴了,如果朋友有新的问题,可以留言给我看看,看我能不能帮。

2013-10-04_131010

 

看看我的状态报告,已经升级到7.23版了,Ya!

24 則留言

  1. UPGRADE.txt Major Upgrade Step 13
    和楼主碰上了一样的问题 不过目前还是找不到问题在哪…
    似乎不是容量的问题

    1. Author

      你的错误讯息是什么?或许可以一起研究一下。

      1. Take the ‘database’ record from the result and put it in your ‘dev’ alias. Put another ‘database’ record in your @stage alias definition; if you make sure that the values are correct, then you do not need to install drush on the remote machine.

        Additional uncaught exception thrown while handling exception.OriginalPDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wecosls.system' doesn't exist: SELECT name, schema_version FROM {system} WHERE type = :type; Array
        (
        [:type] =&gt; module
        )
        in drupal_get_installed_schema_version() (line 155 of /home/yunchen/sls/includes/install.inc).AdditionalPDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wecosls.system' doesn't exist: SELECT * FROM {system} WHERE type = 'theme' OR (type = 'module' AND status = 1) ORDER BY weight ASC, name ASC; Array
        (
        )
        in system_list() (line 165 of /home/yunchen/sls/includes/module.inc).Drush command terminated abnormally due to an unrecoverable error. [error]

        硬碟的话我想容量应该是足够
        升级步骤也是按你的流程也操刀
        那drush在做小升级是ok的~ Drupal6也上至最新版
        现在就尽力在升级Drupal7啰

        1. 阿喔 第一段可以无视 我做笔记不小心多贴了一段(汗)

          1. Author

            你是指这一段吗?
            Take the ‘database’ record from the result and put it in your ‘dev’ alias. Put another ‘database’ record in your @stage alias definition; if you make sure that the values are correct, then you do not need to install drush on the remote machine.

            不过我看到下一段的重要讯息:
            1146 Table ‘wecosls.system’ doesn’t exist: SELECT * FROM {system} WHERE type = ‘theme’ OR (type = ‘module’ AND status = 1) ORDER BY weight ASC, name ASC;
            可能是升级时新旧版本的资料表资料有问题,你可以检查一下程式码,比对一下用到的资料,做修改或许就可以正常了。

          2. 好 感谢提示 有结果我在来分享~

          3. 之前问的问题,先将网站用drush更新后(drush up)
            之后再upgrade这个问题就解掉了 中间出现不少状况也一一处理
            最后碰上这个就没头绪了 就这么短Orz
            SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘public://2_1.JPG’ for [error] key ‘uri’
            想问问你有什么看法?

  2. UPGRADE.txt Major Upgrade Step 13
    和楼主碰上了一样的问题 不过目前还是找不到问题在哪…
    似乎不是容量的问题

    1. Author

      你的错误讯息是什么?或许可以一起研究一下。

      1. Take the ‘database’ record from the result and put it in your ‘dev’ alias. Put another ‘database’ record in your @stage alias definition; if you make sure that the values are correct, then you do not need to install drush on the remote machine.

        Additional uncaught exception thrown while handling exception.OriginalPDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wecosls.system' doesn't exist: SELECT name, schema_version FROM {system} WHERE type = :type; Array
        (
        [:type] =&gt; module
        )
        in drupal_get_installed_schema_version() (line 155 of /home/yunchen/sls/includes/install.inc).AdditionalPDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wecosls.system' doesn't exist: SELECT * FROM {system} WHERE type = 'theme' OR (type = 'module' AND status = 1) ORDER BY weight ASC, name ASC; Array
        (
        )
        in system_list() (line 165 of /home/yunchen/sls/includes/module.inc).Drush command terminated abnormally due to an unrecoverable error. [error]

        硬碟的话我想容量应该是足够
        升级步骤也是按你的流程也操刀
        那drush在做小升级是ok的~ Drupal6也上至最新版
        现在就尽力在升级Drupal7啰

        1. 阿喔 第一段可以无视 我做笔记不小心多贴了一段(汗)

          1. Author

            你是指这一段吗?
            Take the ‘database’ record from the result and put it in your ‘dev’ alias. Put another ‘database’ record in your @stage alias definition; if you make sure that the values are correct, then you do not need to install drush on the remote machine.

            不过我看到下一段的重要讯息:
            1146 Table ‘wecosls.system’ doesn’t exist: SELECT * FROM {system} WHERE type = ‘theme’ OR (type = ‘module’ AND status = 1) ORDER BY weight ASC, name ASC;
            可能是升级时新旧版本的资料表资料有问题,你可以检查一下程式码,比对一下用到的资料,做修改或许就可以正常了。

          2. 好 感谢提示 有结果我在来分享~

          3. 之前问的问题,先将网站用drush更新后(drush up)
            之后再upgrade这个问题就解掉了 中间出现不少状况也一一处理
            最后碰上这个就没头绪了 就这么短Orz
            SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘public://2_1.JPG’ for [error] key ‘uri’
            想问问你有什么看法?

  3. Author

    是不是在uri这个栏位有重复的纪录”public://2_1.JPG”,检查一下这个资料表的用途,重设资料结构或是删除重复记录,应该就可以解决。

    1. 好喔! 我再详细检查一下!
      果然还是db的问题Orz 感谢: p

  4. Author

    是不是在uri这个栏位有重复的纪录”public://2_1.JPG”,检查一下这个资料表的用途,重设资料结构或是删除重复记录,应该就可以解决。

    1. 好喔! 我再详细检查一下!
      果然还是db的问题Orz 感谢: p

  5. 呼~ 最后我也升级成功了 只不过目前网站页面还不能动XD
    在这边附上一些我们这碰到的问题 & 解法 尚未完全整理好 排版不太优请见谅

    aliases.drushrc.php 我们是这样设定才会过…
    ‘localhost’,
    ‘root’ => ‘yourroot’,
    ‘db-url’ => ‘mysqli://youraccount:password@localhost/dbname’,
    ‘databases’ =>
    array (
    ‘default’ =>
    array (
    ‘default’ =>
    array (
    ‘driver’ => ‘mysql’,
    ‘username’ => ‘yourusername’,
    ‘password’ => ‘yourpassword’,
    ‘port’ => ”,
    ‘host’ => ‘localhost’,
    ‘database’ => ‘yournewdbname’,
    ),
    ),
    ),
    );
    ?>

    Q0:
    12-a
    Unknown option: –uninstall. See `drush help pm-disable` for [error]
    available options. To suppress this error, add the option –strict=0.

    A0:
    sudo cp /usr/share/php/drush/example/example.drushrc.php ~/.drush/drushrc.php
    sudo vim ~/.drush/drushrc.php
    补上最后一行 $command_specific[‘pm-disable’] = array(‘strict’ => 0);

    Q1:
    SQLSTATE[42S02]: Base table or view not found: 1146 Table [error]
    ‘wecosls.watchdog’ doesn’t exist

    A1:
    到 sls 资料库中建资料表

    mysql -u root -p
    mysql>use yourdbname;
    mysql>CREATE TABLE `watchdog` (
    `wid` int(11) NOT NULL auto_increment,
    `uid` int(11) NOT NULL default ‘0’,
    `type` varchar(16) NOT NULL default ”,
    `message` longtext NOT NULL,
    `variables` longtext NOT NULL,
    `severity` tinyint(3) unsigned NOT NULL default ‘0’,
    `link` varchar(255) NOT NULL default ”,
    `location` text NOT NULL,
    `referer` varchar(128) NOT NULL default ”,
    `hostname` varchar(128) NOT NULL default ”,
    `timestamp` int(11) NOT NULL default ‘0’,
    PRIMARY KEY (`wid`),
    KEY `type` (`type`)
    ) DEFAULT CHARSET=utf8;

    Q2:

    WD php: PDOException: SQLSTATE[42S02]: Base table or view not found: [error]
    1146 Table ‘wecosls.profile_field’ doesn’t exist: SELECT f.name,
    f.type, v.uid, v.value FROM {profile_field} f INNER JOIN
    {profile_value} v ON f.fid = v.fid WHERE uid IN (:uids_0); Array
    (
    [:uids_0] => 0
    )
    in profile_user_load() (line 254 of
    /home/sls/wecosls/modules/profile/profile.module).
    PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'we cosls.profile_field' doesn't exist: SELECT f.name, f.type, v.uid, v.va lue FROM {profile_field} f INNER JOIN {profile_value} v ON f.fid = v.fid WHERE u id IN (:uids_0); Array
    (
    [:uids_0] => 0
    )
    in profile_user_load() (line 254 of /home/sls/wecosls/modules/profile/profile.m odule).

    A2:

    到 sls 资料库中 重新命名 profile_fields 资料表

    mysql -u root -p
    mysql>use yourdbname;
    mysql>RENAME TABLE sls.profile_fields TO sls.profile_field;
    mysql>exit

    Q3 :
    [ok]
    WD php: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table [error]
    ‘wecosls.profile_value’ doesn’t exist: SELECT f.name, f.type, v.uid, v.value FROM
    {profile_field} f INNER JOIN {profile_value} v ON f.fid = v.fid WHERE uid IN (:uids_0); Array
    (
    [:uids_0] => 0
    )
    in profile_user_load() (line 254 of /home/sls/wecosls/modules/profile/profile.module).
    PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wecosls.profile_value' doesn't exist: SELECT f.name, f.type, v.uid, v.value FROM {profile_field} f INNER JOIN {profile_value} v ON f.fid = v.fid WHERE uid IN (:uids_0); Array
    (
    [:uids_0] => 0
    )
    in profile_user_load() (line 254 of /home/sls/wecosls/modules/profile/profile.module).

    A3 :

    到 sls 资料库中 重新命名 profile_values 资料表

    mysql -u root -p
    mysql>use yourdbname;
    mysql>RENAME TABLE sls.profile_values TO sls.profile_value;
    mysql>exit

    Q4:

    SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘public://2_1.JPG’ for [error]
    key ‘uri’

    A4:

    参考资料 : https://www.drupal.org/node/1260938

    mysql -u root -p
    mysql>use yourdbname;
    mysql>CREATE TABLE tmp SELECT * FROM files GROUP BY filepath, filename;
    mysql>DROP TABLE files;
    mysql>ALTER TABLE tmp RENAME TO files;

    Q5:
    找不到 sls.profile_fields 的table

    A5:

    mysql -u root -p
    mysql>use yourdbname;
    mysql>RENAME TABLE sls.profile_field TO sls.profile_fields;
    mysql>exit

    Q6:
    找不到 sls.profile_values 的table

    A6:

    mysql -u root -p
    mysql>use yourdbname;
    mysql>RENAME TABLE sls.profile_value TO sls.profile_values;
    mysql>exit

    Q7:

    Cannot change the definition of field accesslog.sid: field doesn’t exist.

    A7:

    mysql>CREATE TABLE IF NOT EXISTS `accesslog` (
    `aid` int(11) NOT NULL AUTO_INCREMENT COMMENT ‘Primary Key: Unique accesslog ID.’,
    `sid` varchar(128) NOT NULL DEFAULT ” COMMENT ‘Browser session ID of user that visited page.’,
    `title` varchar(255) DEFAULT NULL COMMENT ‘Title of page visited.’, `path` varchar(255) DEFAULT NULL COMMENT ‘Internal path to page visited (relative to Drupal root.)’,
    `url` text COMMENT ‘Referrer URI.’,
    `hostname` varchar(128) DEFAULT NULL COMMENT ‘Hostname of user that visited the page.’,
    `uid` int(10) unsigned DEFAULT ‘0’ COMMENT ‘User users.uid that visited the page.’,
    `timer` int(10) unsigned NOT NULL DEFAULT ‘0’ COMMENT ‘Time in milliseconds that the page took to load.’,
    `timestamp` int(10) unsigned NOT NULL DEFAULT ‘0’ COMMENT ‘Timestamp of when the page was visited.’,
    PRIMARY KEY (`aid`),
    KEY `accesslog_timestamp` (`timestamp`),
    KEY `uid` (`uid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=’Stores site access information for statistics.’ AUTO_INCREMENT=1 ;

    Q8:

    SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘wecosls.search_index’ doesn’t exist

    A8:

    mysql>CREATE TABLE IF NOT EXISTS `search_index` (
    `word` varchar(50) NOT NULL default ”,
    `sid` int(10) unsigned NOT NULL default ‘0’,
    `type` varchar(16) default NULL,
    `fromsid` int(10) unsigned NOT NULL default ‘0’,
    `fromtype` varchar(16) default NULL,
    `score` float default NULL,
    KEY `sid_type` (`sid`,`type`),
    KEY `from_sid_type` (`fromsid`,`fromtype`),
    KEY `word` (`word`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

  6. 呼~ 最后我也升级成功了 只不过目前网站页面还不能动XD
    在这边附上一些我们这碰到的问题 & 解法 尚未完全整理好 排版不太优请见谅

    aliases.drushrc.php 我们是这样设定才会过…
    ‘localhost’,
    ‘root’ => ‘yourroot’,
    ‘db-url’ => ‘mysqli://youraccount:password@localhost/dbname’,
    ‘databases’ =>
    array (
    ‘default’ =>
    array (
    ‘default’ =>
    array (
    ‘driver’ => ‘mysql’,
    ‘username’ => ‘yourusername’,
    ‘password’ => ‘yourpassword’,
    ‘port’ => ”,
    ‘host’ => ‘localhost’,
    ‘database’ => ‘yournewdbname’,
    ),
    ),
    ),
    );
    ?>

    Q0:
    12-a
    Unknown option: –uninstall. See `drush help pm-disable` for [error]
    available options. To suppress this error, add the option –strict=0.

    A0:
    sudo cp /usr/share/php/drush/example/example.drushrc.php ~/.drush/drushrc.php
    sudo vim ~/.drush/drushrc.php
    补上最后一行 $command_specific[‘pm-disable’] = array(‘strict’ => 0);

    Q1:
    SQLSTATE[42S02]: Base table or view not found: 1146 Table [error]
    ‘wecosls.watchdog’ doesn’t exist

    A1:
    到 sls 资料库中建资料表

    mysql -u root -p
    mysql>use yourdbname;
    mysql>CREATE TABLE `watchdog` (
    `wid` int(11) NOT NULL auto_increment,
    `uid` int(11) NOT NULL default ‘0’,
    `type` varchar(16) NOT NULL default ”,
    `message` longtext NOT NULL,
    `variables` longtext NOT NULL,
    `severity` tinyint(3) unsigned NOT NULL default ‘0’,
    `link` varchar(255) NOT NULL default ”,
    `location` text NOT NULL,
    `referer` varchar(128) NOT NULL default ”,
    `hostname` varchar(128) NOT NULL default ”,
    `timestamp` int(11) NOT NULL default ‘0’,
    PRIMARY KEY (`wid`),
    KEY `type` (`type`)
    ) DEFAULT CHARSET=utf8;

    Q2:

    WD php: PDOException: SQLSTATE[42S02]: Base table or view not found: [error]
    1146 Table ‘wecosls.profile_field’ doesn’t exist: SELECT f.name,
    f.type, v.uid, v.value FROM {profile_field} f INNER JOIN
    {profile_value} v ON f.fid = v.fid WHERE uid IN (:uids_0); Array
    (
    [:uids_0] => 0
    )
    in profile_user_load() (line 254 of
    /home/sls/wecosls/modules/profile/profile.module).
    PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'we cosls.profile_field' doesn't exist: SELECT f.name, f.type, v.uid, v.va lue FROM {profile_field} f INNER JOIN {profile_value} v ON f.fid = v.fid WHERE u id IN (:uids_0); Array
    (
    [:uids_0] => 0
    )
    in profile_user_load() (line 254 of /home/sls/wecosls/modules/profile/profile.m odule).

    A2:

    到 sls 资料库中 重新命名 profile_fields 资料表

    mysql -u root -p
    mysql>use yourdbname;
    mysql>RENAME TABLE sls.profile_fields TO sls.profile_field;
    mysql>exit

    Q3 :
    [ok]
    WD php: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table [error]
    ‘wecosls.profile_value’ doesn’t exist: SELECT f.name, f.type, v.uid, v.value FROM
    {profile_field} f INNER JOIN {profile_value} v ON f.fid = v.fid WHERE uid IN (:uids_0); Array
    (
    [:uids_0] => 0
    )
    in profile_user_load() (line 254 of /home/sls/wecosls/modules/profile/profile.module).
    PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wecosls.profile_value' doesn't exist: SELECT f.name, f.type, v.uid, v.value FROM {profile_field} f INNER JOIN {profile_value} v ON f.fid = v.fid WHERE uid IN (:uids_0); Array
    (
    [:uids_0] => 0
    )
    in profile_user_load() (line 254 of /home/sls/wecosls/modules/profile/profile.module).

    A3 :

    到 sls 资料库中 重新命名 profile_values 资料表

    mysql -u root -p
    mysql>use yourdbname;
    mysql>RENAME TABLE sls.profile_values TO sls.profile_value;
    mysql>exit

    Q4:

    SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘public://2_1.JPG’ for [error]
    key ‘uri’

    A4:

    参考资料 : https://www.drupal.org/node/1260938

    mysql -u root -p
    mysql>use yourdbname;
    mysql>CREATE TABLE tmp SELECT * FROM files GROUP BY filepath, filename;
    mysql>DROP TABLE files;
    mysql>ALTER TABLE tmp RENAME TO files;

    Q5:
    找不到 sls.profile_fields 的table

    A5:

    mysql -u root -p
    mysql>use yourdbname;
    mysql>RENAME TABLE sls.profile_field TO sls.profile_fields;
    mysql>exit

    Q6:
    找不到 sls.profile_values 的table

    A6:

    mysql -u root -p
    mysql>use yourdbname;
    mysql>RENAME TABLE sls.profile_value TO sls.profile_values;
    mysql>exit

    Q7:

    Cannot change the definition of field accesslog.sid: field doesn’t exist.

    A7:

    mysql>CREATE TABLE IF NOT EXISTS `accesslog` (
    `aid` int(11) NOT NULL AUTO_INCREMENT COMMENT ‘Primary Key: Unique accesslog ID.’,
    `sid` varchar(128) NOT NULL DEFAULT ” COMMENT ‘Browser session ID of user that visited page.’,
    `title` varchar(255) DEFAULT NULL COMMENT ‘Title of page visited.’, `path` varchar(255) DEFAULT NULL COMMENT ‘Internal path to page visited (relative to Drupal root.)’,
    `url` text COMMENT ‘Referrer URI.’,
    `hostname` varchar(128) DEFAULT NULL COMMENT ‘Hostname of user that visited the page.’,
    `uid` int(10) unsigned DEFAULT ‘0’ COMMENT ‘User users.uid that visited the page.’,
    `timer` int(10) unsigned NOT NULL DEFAULT ‘0’ COMMENT ‘Time in milliseconds that the page took to load.’,
    `timestamp` int(10) unsigned NOT NULL DEFAULT ‘0’ COMMENT ‘Timestamp of when the page was visited.’,
    PRIMARY KEY (`aid`),
    KEY `accesslog_timestamp` (`timestamp`),
    KEY `uid` (`uid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=’Stores site access information for statistics.’ AUTO_INCREMENT=1 ;

    Q8:

    SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘wecosls.search_index’ doesn’t exist

    A8:

    mysql>CREATE TABLE IF NOT EXISTS `search_index` (
    `word` varchar(50) NOT NULL default ”,
    `sid` int(10) unsigned NOT NULL default ‘0’,
    `type` varchar(16) default NULL,
    `fromsid` int(10) unsigned NOT NULL default ‘0’,
    `fromtype` varchar(16) default NULL,
    `score` float default NULL,
    KEY `sid_type` (`sid`,`type`),
    KEY `from_sid_type` (`fromsid`,`fromtype`),
    KEY `word` (`word`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;



Comments are closed.