Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 22nd, 2010 | Syntax: None | Size: 2.83 KB | Hits: 95 | Expires: Never
Copy text to clipboard
  1. Index: server/src/akonadi.cpp
  2. ===================================================================
  3. --- server/src/akonadi.cpp
  4. +++ server/src/akonadi.cpp      2010-03-22 10:15:12.000000000 +0100
  5. @@ -368,11 +368,15 @@
  6.  void AkonadiServer::startMysqlDatabaseProcess()
  7.  {
  8.    const QString mysqldPath = DbConfig::serverPath();
  9. +  const QStringList mysqldSearchPath = DbConfig::mysqldSearchPath();
  10.  
  11.    const QString dataDir = XdgBaseDirs::saveDir( "data", QLatin1String( "akonadi/db_data" ) );
  12.    const QString akDir   = XdgBaseDirs::saveDir( "data", QLatin1String( "akonadi/" ) );
  13.    const QString miscDir = XdgBaseDirs::saveDir( "data", QLatin1String( "akonadi/db_misc" ) );
  14.    const QString fileDataDir = XdgBaseDirs::saveDir( "data", QLatin1String( "akonadi/file_db_data" ) );
  15. +  const QString mMysqlInstallDbPath = XdgBaseDirs::findExecutableFile( QLatin1String( "mysql_install_db" ), mysqldSearchPath );
  16. +  akDebug() << "Found mysql_install_db: " << mMysqlInstallDbPath;
  17. +
  18.  
  19.    // generate config file
  20.    const QString globalConfig = XdgBaseDirs::findResourceFile( "config", QLatin1String( "akonadi/mysql-global.conf" ) );
  21. @@ -443,6 +447,12 @@
  22.      }
  23.    }
  24.  
  25. +  // first run, some MySQL versions need a mysql_install_db run for that
  26. +  if ( QDir( dataDir ).entryList( QDir::NoDotAndDotDot | QDir::AllEntries ).isEmpty() && !mMysqlInstallDbPath.isEmpty() ) {
  27. +    const QStringList arguments = QStringList() << QString::fromLatin1( "--datadir=%1/" ).arg( dataDir );
  28. +    QProcess::execute( mMysqlInstallDbPath, arguments );
  29. +  }
  30. +
  31.    // clear mysql ib_logfile's in case innodb_log_file_size option changed in last confUpdate
  32.    if ( confUpdate ) {
  33.        QFile(dataDir + QDir::separator() + QString::fromLatin1( "ib_logfile0" )).remove();
  34. Index: server/src/storage/dbconfig.cpp
  35. ===================================================================
  36. --- server/src/storage/dbconfig.cpp
  37. +++ server/src/storage/dbconfig.cpp     2010-03-22 10:13:08.000000000 +0100
  38. @@ -299,3 +299,15 @@
  39.      return sInstance()->mCleanServerShutdownCommand;
  40.  }
  41.  
  42. +QStringList DbConfig::mysqldSearchPath()
  43. +{
  44. +const QStringList mysqldSearchPath = QStringList()
  45. +  << QLatin1String("/usr/sbin")
  46. +  << QLatin1String("/usr/local/sbin")
  47. +  << QLatin1String("/usr/local/libexec")
  48. +  << QLatin1String("/usr/libexec")
  49. +  << QLatin1String("/opt/mysql/libexec")
  50. +  << QLatin1String("/opt/local/lib/mysql5/bin");
  51. +
  52. +    return mysqldSearchPath ;
  53. +}
  54. Index: server/src/storage/dbconfig.h
  55. ===================================================================
  56. --- server/src/storage/dbconfig.h
  57. +++ server/src/storage/dbconfig.h       2010-03-22 10:14:28.000000000 +0100
  58. @@ -76,6 +76,11 @@
  59.     * exists.
  60.     */
  61.    QString cleanServerShutdownCommand();
  62. +
  63. +  /**
  64. +   * Returns the path where mysql binaries are searched
  65. +   */
  66. +  QStringList mysqldSearchPath() ;
  67.  }
  68.  
  69.  #endif