viktorthang / wordpress-custom-content-type-manager

Automatically exported from code.google.com/p/wordpress-custom-content-type-manager
0 stars 0 forks source link

Cached directory not changing when installed on multiple servers #206

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem? (Be specific)
1. Install on one server
2. Copy WordPress to different server using same external DB using 
define('WP_SITEURL','...) and define('WP_HOME','...') in wp-config.php
3. Try to view on both, but will only work on one of them.

What is the expected output? What do you see instead?
Not able to find the filters directory on the second server because it is 
searching for the location that is located in on the first server.

Does the problem continue if you disable all other plugins?
Yes

Please provide any additional information below (e.g. Browser, version,
OS):
Server 1 is a Linux server with files in "/var/www".  Server 2 is a Windows 
server with files in "D:\wwwroot". This will be in the error log on Server 2: 
"include_once(/var/www/wp-content/plugins/custom-content-type-manager/includes/f
ilters/to_image_src.php) ... failed to open stream: No such file or directory 
in 
D:\\wwwroot\\wp-content\\plugins\\custom-content-type-manager\\includes\\CCTM.ph
p on line 1358" 

I just started using this plugin and had this problem on 0.9.4.1 and 0.9.4.2

Original issue reported on code.google.com by jason.ch...@gmail.com on 9 Oct 2011 at 8:52

GoogleCodeExporter commented 8 years ago
Thanks for filing this issue with so many relevant details.

Yeah, I can imagine that the plugin doesn't work in this situation.  In order 
to avoid repeated directory scans, the plugin caches some of the results -- in 
your case, one server is caching its path to the files, and that same path is 
not accurate on server 2.   I hadn't even considered the type of scenario 
you've outlined here when I implemented the directory caching -- that is a 
somewhat unusual server setup.

I'll have to think about this... one simple option might be to make a setting 
that enables/disables directory caching.  Forcing a fresh directory scan might 
be the only way for this to work in your situation.   

I'll look into it...

Original comment by fireproofsocks on 10 Oct 2011 at 1:06

GoogleCodeExporter commented 8 years ago
Yes thank you!  I found this plugin last week and it's exactly what WordPress 
needs.  Wouldn't be surprised if something like this isn't integrated into the 
WP core at some point.

Anyway, yes it would be nice if you could turn off directory caching.  Or maybe 
you could use relative directories instead of absolute?

Thanks!

Original comment by jason.ch...@gmail.com on 10 Oct 2011 at 4:54

GoogleCodeExporter commented 8 years ago
Committed revision 450168.

Ok, I've implemented the directory caching as a Setting (see the Custom Content 
Types--> Settings menu).

The patch is available @ http://wpcctm.com/ and it'll be released with the 
0.9.4.3 patch.  If you could verify that this works for you, it'd be great.  
Thanks!

Original comment by fireproofsocks on 12 Oct 2011 at 7:11

GoogleCodeExporter commented 8 years ago
Actually, that didn't solve my problem.  There's one more place where directory 
caching needs to be turned off in include_output_filter_class() in CCTM.php and 
when I did that it worked for me.  Also, in the global settings I was having 
trouble getting it to save the directory caching option.

Thanks again.

Original comment by jason.ch...@gmail.com on 13 Oct 2011 at 5:40

GoogleCodeExporter commented 8 years ago
Ah, good catch.  Maybe I shouldn't try coding this stuff at 3am haha.  Ok, I've 
updated the areas in question and fixed the saving of the checkbox on the 
settings page.

I'm having some trouble with the build script, so I'm just attaching the zip 
file here.

Committed revision 450792.

Original comment by fireproofsocks on 13 Oct 2011 at 9:27

Attachments:

GoogleCodeExporter commented 8 years ago
similar issue:
CTM 0.9.5.5
Wp 3.3.1
the error is visible on ..wp-admin/admin.php?page=cctm_fields

the log:
Notice: Undefined index: port in 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/includes/CCTM.p
hp on line 1358 Call Stack: 0.0016 766424 1. {main}() 
/var/www/testpage/wp-admin/admin.php:0 0.3231 37057424 2. do_action() 
/var/www/testpage/wp-admin/admin.php:151 0.3232 37059904 3. 
call_user_func_array() /var/www/testpage/wp-includes/plugin.php:405 0.3232 
37059960 4. CCTM::page_main_controller() 
/var/www/testpage/wp-includes/plugin.php:405 0.3235 37110592 5. 
include('/var/www/testpage/wp-content/plugins/custom-content-type-manager/contro
llers/list_custom_fields.php') 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/includes/CCTM.p
hp:1637 0.3267 37254144 6. CCTM::is_valid_img() 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/controllers/lis
t_custom_fields.php:44 Notice: Undefined index: port in 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/includes/CCTM.p
hp on line 1358 Call Stack: 0.0016 766424 1. {main}() 
/var/www/testpage/wp-admin/admin.php:0 0.3231 37057424 2. do_action() 
/var/www/testpage/wp-admin/admin.php:151 0.3232 37059904 3. 
call_user_func_array() /var/www/testpage/wp-includes/plugin.php:405 0.3232 
37059960 4. CCTM::page_main_controller() 
/var/www/testpage/wp-includes/plugin.php:405 0.3235 37110592 5. 
include('/var/www/testpage/wp-content/plugins/custom-content-type-manager/contro
llers/list_custom_fields.php') 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/includes/CCTM.p
hp:1637 0.3267 37254144 6. CCTM::is_valid_img() 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/controllers/lis
t_custom_fields.php:44 Notice: Undefined index: port in 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/includes/CCTM.p
hp on line 1358 Call Stack: 0.0016 766424 1. {main}() 
/var/www/testpage/wp-admin/admin.php:0 0.3231 37057424 2. do_action() 
/var/www/testpage/wp-admin/admin.php:151 0.3232 37059904 3. 
call_user_func_array() /var/www/testpage/wp-includes/plugin.php:405 0.3232 
37059960 4. CCTM::page_main_controller() 
/var/www/testpage/wp-includes/plugin.php:405 0.3235 37110592 5. 
include('/var/www/testpage/wp-content/plugins/custom-content-type-manager/contro
llers/list_custom_fields.php') 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/includes/CCTM.p
hp:1637 0.3302 37256040 6. CCTM::is_valid_img() 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/controllers/lis
t_custom_fields.php:44 Notice: Undefined index: port in 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/includes/CCTM.p
hp on line 1358 Call Stack: 0.0016 766424 1. {main}() 
/var/www/testpage/wp-admin/admin.php:0 0.3231 37057424 2. do_action() 
/var/www/testpage/wp-admin/admin.php:151 0.3232 37059904 3. 
call_user_func_array() /var/www/testpage/wp-includes/plugin.php:405 0.3232 
37059960 4. CCTM::page_main_controller() 
/var/www/testpage/wp-includes/plugin.php:405 0.3235 37110592 5. 
include('/var/www/testpage/wp-content/plugins/custom-content-type-manager/contro
llers/list_custom_fields.php') 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/includes/CCTM.p
hp:1637 0.3302 37256040 6. CCTM::is_valid_img() 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/controllers/lis
t_custom_fields.php:44 Notice: Undefined index: port in 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/includes/CCTM.p
hp on line 1358 Call Stack: 0.0016 766424 1. {main}() 
/var/www/testpage/wp-admin/admin.php:0 0.3231 37057424 2. do_action() 
/var/www/testpage/wp-admin/admin.php:151 0.3232 37059904 3. 
call_user_func_array() /var/www/testpage/wp-includes/plugin.php:405 0.3232 
37059960 4. CCTM::page_main_controller() 
/var/www/testpage/wp-includes/plugin.php:405 0.3235 37110592 5. 
include('/var/www/testpage/wp-content/plugins/custom-content-type-manager/contro
llers/list_custom_fields.php') 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/includes/CCTM.p
hp:1637 0.3336 37257280 6. CCTM::is_valid_img() 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/controllers/lis
t_custom_fields.php:44 Notice: Undefined index: port in 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/includes/CCTM.p
hp on line 1358 Call Stack: 0.0016 766424 1. {main}() 
/var/www/testpage/wp-admin/admin.php:0 0.3231 37057424 2. do_action() 
/var/www/testpage/wp-admin/admin.php:151 0.3232 37059904 3. 
call_user_func_array() /var/www/testpage/wp-includes/plugin.php:405 0.3232 
37059960 4. CCTM::page_main_controller() 
/var/www/testpage/wp-includes/plugin.php:405 0.3235 37110592 5. 
include('/var/www/testpage/wp-content/plugins/custom-content-type-manager/contro
llers/list_custom_fields.php') 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/includes/CCTM.p
hp:1637 0.3336 37257280 6. CCTM::is_valid_img() 
/var/www/testpage/wp-content/plugins/custom-content-type-manager/controllers/lis
t_custom_fields.php:44

Plus when I want to select the new relation page the popup window shows this:

WordPress database error: [Table 'test_db.wp_posts' doesn't exist]
SELECT DISTINCT DATE_FORMAT(post_date,'%Y%m') as 'yearmonth' , 
DATE_FORMAT(post_date,'%M') as 'month' , YEAR(post_date) as 'year' FROM 
wp_posts WHERE post_status = 'publish' ORDER BY yearmonth

Original comment by 2...@emblem.cc on 16 Jan 2012 at 8:33

GoogleCodeExporter commented 8 years ago
I think I found out why there is the second problem.
[Table 'test_db.wp_posts' doesn't exist]
Indeed it doesn't exists because I use custom table prefix :)

I think your plugin doesn't consider such cases, at least in the corresponding 
part of the code.

Original comment by 2...@emblem.cc on 16 Jan 2012 at 9:22

GoogleCodeExporter commented 8 years ago
Please post this as a new issue.  Thanks.

I missed a couple spots where I had hard-coded the database table names in 
early versions of the 0.9.5 branch, but that's been patched and it only 
affected the Summarize Posts integration...  the original thread here related 
to a custom setup where 2 instances of WP connected to a single database.  Are 
you trying to do that too?  I rewrote the code that handled this so the 
directory caching no longer takes place, so this probably merits its own issue. 
 In other words, I  think what you're reporting here has nothing to do with the 
original issue.

The log is helpful, but you should always include your system information for 
stuff like this: the line you mention in particular relates to PHP's 
parse_url() function, which may have different behavior on different operating 
systems.  Are you using any of your own custom fields?  
http://code.google.com/p/wordpress-custom-content-type-manager/wiki/CustomCustom
Fields   

Original comment by ever...@fireproofsocks.com on 16 Jan 2012 at 10:56

GoogleCodeExporter commented 8 years ago
I will.

No I'm not trying to connect to connect with two WP to one DB.
The reason I thought it is similar issue is that it both collide on "CCTM.php 
on line 1358"

..and I'm not using any custom fields I could possibly made by my own. ;)
The actual setup runs on localhost, single install, single database, Linux 
machine.

I'll post the issue with table prefix as a new issue.
If the first error has nothing to do with the actual topic, let me know, I'll 
make a new separate issue.

Original comment by 2...@emblem.cc on 17 Jan 2012 at 8:47

GoogleCodeExporter commented 8 years ago
Thanks.  It keeps me sane.

Original comment by ever...@fireproofsocks.com on 17 Jan 2012 at 4:16