Skip to content

issue #959 - configurable write directory#1185

Closed
pushingit wants to merge 1 commit into
ThinkUpLLC:masterfrom
pushingit:959-datadir
Closed

issue #959 - configurable write directory#1185
pushingit wants to merge 1 commit into
ThinkUpLLC:masterfrom
pushingit:959-datadir

Conversation

@pushingit

Copy link
Copy Markdown
Contributor

making for a single directory under which the webserver needs to write to
making sure not to default to tmp as that gets auto-cleaned on some systems

  • using $THINKUP_CFG["datadir_path"], defaults to 'data' under the thinkup root
  • directories moved under 'data': 'compiled_view', 'cache', 'logs'
  • added helper functions:
    -- Utils::getDataPath($str) - absolute path to data - if $str given, data/$str
    -- Utils::getBackupPath($str) - data/backup/$str
    -- Plugin->getDataPath($str) - data/plugins/$plugin_folder_name/$str

making for a single directory under which the webserver needs to write to

- using $THINKUP_CFG["datadir_path"], defaults to 'data' under the thinkup root

- directories moved under 'data': 'compiled_view', 'cache', 'logs'

- added helper functions:
-- Utils::getDataPath($str) - absolute path to data - if $str given, data/$str
-- Utils::getBackupPath($str) - data/backup/$str
-- Plugin->getDataPath($str) - data/plugins/$plugin_folder_name/$str
@ginatrapani

Copy link
Copy Markdown
Member

Thanks for this pull request, we've needed to move the default location of the writable directory for awhile. There are two problems which have to be resolved before I merge:

  1. This patch assumes that the config file has a datadir_path defined. But thousands of ThinkUp installations do not, so when they upgrade things break. The app should assume if there's no datadir_path defined in config.inc.php, that it's the original lib/view/compiled_view directory location.
  2. This patch is causing test failures in the ExportDAO, because it's missing the webapp directory in the export file path. Remember: development environments have the webapp folder, but user installations do not. Failure details:

Unexpected exception of type [PDOException] with message [Database error!
ThinkUp could not execute the following query:
SELECT * INTO OUTFILE '/Users/gina/Sites/thinkup/data/backup/favorites.tmp' FROM tu_favorites WHERE fav_of_user_id = :user_id AND network = :network;
PDOException: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/Users/gina/Sites/thinkup/data/backup/favorites.tmp' (Errcode: 13)] in [/Users/gina/Sites/thinkup/webapp/_lib/model/class.PDODAO.php line 210]
in testExportFavoritesOfServiceUser
in TestOfExportMySQLDAO
Exception 20!
Unexpected exception of type [PDOException] with message [Database error!
ThinkUp could not execute the following query:
SELECT * INTO OUTFILE '/Users/gina/Sites/thinkup/data/backup/encoded_locations.tmp' FROM tu_encoded_locations;
PDOException: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/Users/gina/Sites/thinkup/data/backup/encoded_locations.tmp' (Errcode: 13)] in [/Users/gina/Sites/thinkup/webapp/_lib/model/class.PDODAO.php line 210]
in testExportGeoToFile
in TestOfExportMySQLDAO
Exception 21!
Unexpected exception of type [PDOException] with message [Database error!
ThinkUp could not execute the following query:
SELECT * INTO OUTFILE '/Users/gina/Sites/thinkup/data/backup/posts.tmp' FROM posts_tmp
PDOException: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/Users/gina/Sites/thinkup/data/backup/posts.tmp' (Errcode: 13)] in [/Users/gina/Sites/thinkup/webapp/_lib/model/class.PDODAO.php line 210]
in testExportToFile
in TestOfExportMySQLDAO
Database error!
ThinkUp could not execute the following query:
select * INTO OUTFILE '/Users/gina/Sites/thinkup/data/backup/tu_encoded_locations.txt' from tu_encoded_locations
PDOException: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/Users/gina/Sites/thinkup/data/backup/tu_encoded_locations.txt' (Errcode: 13)

@thegeekiestmark

Copy link
Copy Markdown
Contributor

On Thu, Jan 26, 2012 at 7:51 PM, Gina Trapani <
reply@reply.github.com

wrote:

Thanks for this pull request, we've needed to move the default location of
the writable directory for awhile. There are two problems which have to be
resolved before I merge:

  1. This patch assumes that the config file has a datadir_path defined. But
    thousands of ThinkUp installations do not, so when they upgrade things
    break. The app should assume if there's no datadir_path defined in
    config.inc.php, that it's the original lib/view/compiled_view directory
    location.

Interesting. I thought I had accounted for that possibility. Still, it's an
easy fix.

  1. This patch is causing test failures in the ExportDAO, because it's
    missing the webapp directory in the export file path. Remember: development
    environments have the webapp folder, but user installations do not.
    Failure details:

Unexpected exception of type [PDOException] with message [Database error!

ThinkUp could not execute the following query:
SELECT * INTO
OUTFILE '/Users/gina/Sites/thinkup/data/backup/favorites.tmp' FROM
tu_favorites WHERE fav_of_user_id = :user_id AND network = :network;

PDOException: SQLSTATE[HY000]: General error: 1 Can't create/write to
file '/Users/gina/Sites/thinkup/data/backup/favorites.tmp' (Errcode: 13)]
in [/Users/gina/Sites/thinkup/webapp/_lib/model/class.PDODAO.php line 210]
in testExportFavoritesOfServiceUser
in TestOfExportMySQLDAO
Exception 20!
Unexpected exception of type [PDOException] with message [Database error!

ThinkUp could not execute the following query:
SELECT * INTO
OUTFILE '/Users/gina/Sites/thinkup/data/backup/encoded_locations.tmp' FROM
tu_encoded_locations;
PDOException: SQLSTATE[HY000]: General error: 1
Can't create/write to file
'/Users/gina/Sites/thinkup/data/backup/encoded_locations.tmp' (Errcode:
13)] in [/Users/gina/Sites/thinkup/webapp/_lib/model/class.PDODAO.php line
210]
in testExportGeoToFile
in TestOfExportMySQLDAO
Exception 21!
Unexpected exception of type [PDOException] with message [Database error!

ThinkUp could not execute the following query:
SELECT * INTO
OUTFILE '/Users/gina/Sites/thinkup/data/backup/posts.tmp' FROM posts_tmp

PDOException: SQLSTATE[HY000]: General error: 1 Can't create/write to
file '/Users/gina/Sites/thinkup/data/backup/posts.tmp' (Errcode: 13)] in
[/Users/gina/Sites/thinkup/webapp/_lib/model/class.PDODAO.php line 210]
in testExportToFile
in TestOfExportMySQLDAO
Database error!
ThinkUp could not execute the following query:

select * INTO OUTFILE
'/Users/gina/Sites/thinkup/data/backup/tu_encoded_locations.txt' from
tu_encoded_locations
PDOException: SQLSTATE[HY000]: General error: 1
Can't create/write to file
'/Users/gina/Sites/thinkup/data/backup/tu_encoded_locations.txt' (Errcode:
13)

Thanks for the details. Doesn't sound like it would be too difficult for me
to fix.

How quickly to you need to get this resolved? I anticipate it would only
take an hour or two, but I've already made plans for the weekend. I
probably couldn't get to it until the middle of next week. Would that be
alright? Thanks!

Mark


Reply to this email directly or view it on GitHub:
#1185 (comment)

@ginatrapani

Copy link
Copy Markdown
Member

Hey Mark--this is actually @pushingit's pull request. Looking into it a bit more, I realize the test failures are probably a permissions problem in my dev environment. I'm troubleshooting that today.

@thegeekiestmark

Copy link
Copy Markdown
Contributor

Whoops - thought the message was for me directly :) Anyway, I'll probably
have a day or two open this week, so just let me know if you need any of my
help. Thanks!

Mark

On Sun, Jan 29, 2012 at 10:01 AM, Gina Trapani <
reply@reply.github.com

wrote:

Hey Mark--this is actually @pushingit's pull request. Looking into it a
bit more, I realize the test failures are probably a permissions problem in
my dev environment. I'm troubleshooting that today.

@ginatrapani

Copy link
Copy Markdown
Member

I got my permissions issue sorted out, and made a few more fixes/enhancements/clarifications in b56dcab and merged. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants