CraigT543 / EasyBlue

Modifications for Easy!Appointments
21 stars 23 forks source link

Vanilla Build fails on getting unavailable_dates #3

Closed bullmoose20 closed 7 years ago

bullmoose20 commented 7 years ago

timeout error of 500, [23-Mar-2017 00:03:42 CST6CDT] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 32 bytes) in /home/complexe/public_html/eb/application/controllers/Appointments.php on line 906

Not sure what is going wrong.....

You also get a json error when you wait about 25 seconds on first page.

CraigT543 commented 7 years ago

I would look at the memory limit in your php.ini file. Try

memory_limit =1024M

That is where mine is set.

bullmoose20 commented 7 years ago

I get some pretty nasty errors whenever I setup php.ini with EasyBlue. check it out: https://complexelepheonix.com/eb/

All I have is 1 php.ini file in the root of the /eb folder with the 1 entry above of 1024M

Warning: date(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/complexe/public_html/eb/system/core/Log.php on line 176

Warning: date(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/complexe/public_html/eb/system/core/Log.php on line 206 A PHP Error was encountered

Severity: Warning

Message: mkdir(): Invalid path

Filename: drivers/Session_files_driver.php

Line Number: 117

CraigT543 commented 7 years ago

This is a similar issue:

http://stackoverflow.com/questions/33197751/fonts-are-blocked-in-web-client-cors

So part of this is a CORS issue. It looks like .htaccess file needs to be edited to allow for access on your server.

Craig

On 3/27/2017 10:02 AM, bullmoose20 wrote:

I get some pretty nasty errors whenever I setup php.ini with EasyBlue. check it out: https://complexelepheonix.com/eb/

All I have is 1 php.ini file in the root of the /eb folder with the 1 entry above of 1024M

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CraigT543/EasyBlue/issues/3#issuecomment-289517045, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyI7MCHNlzYGdOrepuAtu43bHYyQ_rAks5rp-uSgaJpZM4MmNjv.

CraigT543 commented 7 years ago

Also, in my php.ini file I make the following modifications

I had to addthe following:

max_input_vars = 5000

display_errors = Off

register_globals = Off

max_execution_time = 5000

max_input_time = 5000

memory_limit = 1024M

register_argc_argv = On

post_max_size = 750M

upload_max_filesize = 750M

date.timezone=US/Pacific //set to your location of course

session.gc_maxlifetime = 14400

This makes my site role. So you may have some of these and you may need to add some.

The location issue came up for me one time. The server set the location in two places, not just the php.ini file. In the console of the server there was a setting for location that was a global variable. Until I set that nothing was working right. I use a Synology server and they updated their special os to include this for convenience I guess but it made my life hell for a week. Until I found this global variable I made a custom ini file to override what ever the system was doing so that the correct time zone was being processed.

Craig

On 3/27/2017 10:02 AM, bullmoose20 wrote:

I get some pretty nasty errors whenever I setup php.ini with EasyBlue. check it out: https://complexelepheonix.com/eb/

All I have is 1 php.ini file in the root of the /eb folder with the 1 entry above of 1024M

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CraigT543/EasyBlue/issues/3#issuecomment-289517045, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyI7MCHNlzYGdOrepuAtu43bHYyQ_rAks5rp-uSgaJpZM4MmNjv.

bullmoose20 commented 7 years ago

Ini files aside, I can run the original Alex Build with my host provider's default settings. No ini file required. What is it about your build that would require such extremely high numbers in your ini file?

I suspect that you have always had this "issue" and solved it through enhancing the server values, but in fact we should be able to track the data sent and received to the server to understand where the problem is.

This is what I am attempting to do, with little success. I thought that taking your build and removing things until it would work would be faster than taking Alex's build and applying all your edits one by 1 until I find the culprit, but now I am not sure anymore.

CraigT543 commented 7 years ago

When alex loads his calendar he is really only loading a week worth of data at a time. I am loading 60 days. His usually just syncs a week of data from google calendar and I am doing 60 days. You can shorten the number of days too and that could work. My numbers also allow for larger uploads to my site because I do other things like have people download larger files and video files. So you may not need all this but the numbers are what I use. Craig

On 3/27/2017 12:09 PM, bullmoose20 wrote:

Ini files aside, I can run the original Alex Build with my host provider's default settings. No ini file required. What is it about your build that would require such extremely high numbers in your ini file?

I suspect that you have always had this "issue" and solved it through enhancing the server values, but in fact we should be able to track the data sent and received to the server to understand where the problem is.

This is what I am attempting to do, with little success. I thought that taking your build and removing things until it would work would be faster than taking Alex's build and applying all your edits one by 1 until I find the culprit, but now I am not sure anymore.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CraigT543/EasyBlue/issues/3#issuecomment-289554196, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyI7MQkb1XIXjHra1oWNcfD3I7MQlsGks5rqAlegaJpZM4MmNjv.

--

Thank you,

Craig

Craig Tucker, LCSW Logo

•LCS 20312•craigtuckerlcsw@verizon.net mailto:craigtuckerlcsw@verizon.net•www.craigtuckerlcsw.com http://www.craigtuckerlcsw.com/

•333 East Stuart Ave, Suite F, Redlands, CA 92374•Phone (909) 389-2414 • Fax (909) 353-4982•

CONFIDENTIALITY NOTICE: This email transmission, including any attachments that accompany it, may contain confidential information belonging to the sender that is protected by law and is for the exclusive use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, or distribution of information in this transmission, or the taking of any action in reliance on the contents of this transmission, is strictly prohibited. Any unauthorized interception of this transmission is illegal under the law. If you have received this transmission in error, please notify the sender by reply email right away and then destroy all copies of this transmission.

bullmoose20 commented 7 years ago

My calendar is completely empty.... So timeout values and size limits should be fine.

I even thought that because it was empty, that it might be the problem so I created an appointment.

I am just thinking that having debugging tools, we should be able to see the data sent and received from the server to know if we are hitting timeout and memory limits.

I might just get wireshark going and do a network trace because I dont know what else to do.

CraigT543 commented 7 years ago

I am not sure why it is not working. All I can say is the same build is working on my end with a full database and has been for nearly a year in different iterations. I have had others use it and say that they got it going. So I am not sure myself. The ajax stuff is usually an addressing thing so if it is not an inconsistency with ssl then I am not sure from there. And I am not sure why alex's works for you and mind does not. All that is odd.

Craig

On 3/27/2017 1:17 PM, bullmoose20 wrote:

My calendar is completely empty.... So timeout values and size limits should be fine.

I even thought that because it was empty, that it might be the problem so I created an appointment.

I am just thinking that having debugging tools, we should be able to see the data sent and received from the server to know if we are hitting timeout and memory limits.

I might just get wireshark going and do a network trace because I dont know what else to do.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CraigT543/EasyBlue/issues/3#issuecomment-289572591, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyI7GdcmCYmPl3x7Ruv0m3JC9K6R8pZks5rqBlCgaJpZM4MmNjv.

--

Thank you,

Craig

Craig Tucker, LCSW Logo

•LCS 20312•craigtuckerlcsw@verizon.net mailto:craigtuckerlcsw@verizon.net•www.craigtuckerlcsw.com http://www.craigtuckerlcsw.com/

•333 East Stuart Ave, Suite F, Redlands, CA 92374•Phone (909) 389-2414 • Fax (909) 353-4982•

CONFIDENTIALITY NOTICE: This email transmission, including any attachments that accompany it, may contain confidential information belonging to the sender that is protected by law and is for the exclusive use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, or distribution of information in this transmission, or the taking of any action in reliance on the contents of this transmission, is strictly prohibited. Any unauthorized interception of this transmission is illegal under the law. If you have received this transmission in error, please notify the sender by reply email right away and then destroy all copies of this transmission.

bullmoose20 commented 7 years ago

Definitely odd. 😃

Just so I understand, why are you choosing to load 60 days worth of data? I realize that you dont want people booking more than 60 days out, but in theory, you only need to pull 30 days at most and grey out the calendar from 60 days from today and beyond. Essentially the current months worth of active dates.

I will keep plugging away...

bullmoose20 commented 7 years ago

So check out this: https://www.craigtuckerlcsw.com/easy/index.php/appointments/ajax_get_unavailable_dates?max_date=10&provider_id=85&service_id=23&selected_date=2017-04-01&csrfToken=bbec398bd8677c7450053bbd1b01c8ed

I manually set the max_date=10 and the selected_date=2017-04-01 in the string on your server and I get: ["2017-04-01","2017-04-02","2017-04-03","2017-04-07","2017-04-08","2017-04-09","2017-04-10","2017-04-11","2017-04-12","2017-04-13","2017-04-14","2017-04-15","2017-04-16","2017-04-17","2017-04-18","2017-04-19","2017-04-20","2017-04-21","2017-04-22","2017-04-23","2017-04-24","2017-04-25","2017-04-26","2017-04-27","2017-04-28","2017-04-29","2017-04-30"]

4th 5th and 6th are missing from the resulting set.

Now I set it to max_date=1: https://www.craigtuckerlcsw.com/easy/index.php/appointments/ajax_get_unavailable_dates?max_date=1&provider_id=85&service_id=23&selected_date=2017-04-01&csrfToken=bbec398bd8677c7450053bbd1b01c8ed

and I get the following: ["2017-04-01","2017-04-02","2017-04-03","2017-04-04","2017-04-05","2017-04-06","2017-04-07","2017-04-08","2017-04-09","2017-04-10","2017-04-11","2017-04-12","2017-04-13","2017-04-14","2017-04-15","2017-04-16","2017-04-17","2017-04-18","2017-04-19","2017-04-20","2017-04-21","2017-04-22","2017-04-23","2017-04-24","2017-04-25","2017-04-26","2017-04-27","2017-04-28","2017-04-29","2017-04-30"] It includes all dates in April. Changing the max_date from 1 to 7 gives the same resulting set. As soon as you change it to 8, you get the following: https://www.craigtuckerlcsw.com/easy/index.php/appointments/ajax_get_unavailable_dates?max_date=8&provider_id=85&service_id=23&selected_date=2017-04-01&csrfToken=bbec398bd8677c7450053bbd1b01c8ed

["2017-04-01","2017-04-02","2017-04-03","2017-04-05","2017-04-06","2017-04-07","2017-04-08","2017-04-09","2017-04-10","2017-04-11","2017-04-12","2017-04-13","2017-04-14","2017-04-15","2017-04-16","2017-04-17","2017-04-18","2017-04-19","2017-04-20","2017-04-21","2017-04-22","2017-04-23","2017-04-24","2017-04-25","2017-04-26","2017-04-27","2017-04-28","2017-04-29","2017-04-30"]

April 4th is missing.

Here is the summary of the string and resulting set of dates progressed from 1-60. max_date=1,2,3,4,5,6,7 --> complete set of dates for april max_date=8 --> 4th of april missing max_date=9 --> 4,5th of april missing max_date=10 --> 4,5,6th of april missing max_date=11 --> 4,5,6,7 of april missing max_date=11,12,13,14 --> 4,5,6,7 of april missing max_date=15 --> 4,5,6,7,11 of april missing max_date=16 --> 4,5,6,7,11,12 of april missing max_date=17 --> 4,5,6,7,11,12,13 of april missing max_date=18,19,20,21 --> 4,5,6,7,11,12,13,14 of april missing max_date=22 --> 4,5,6,7,11,12,13,14,18 of april missing max_date=23 --> 4,5,6,7,11,12,13,14,18,19 of april missing max_date=24 --> 4,5,6,7,11,12,13,14,18,19,20 of april missing max_date=25,26,27,28 --> 4,5,6,7,11,12,13,14,18,19,20,21 of april missing max_date=29 --> 4,5,6,7,11,12,13,14,18,19,20,21,25 of april missing max_date=30 --> 4,5,6,7,11,12,13,14,18,19,20,21,25,26 of april missing max_date=31 --> 4,5,6,7,11,12,13,14,18,19,20,21,25,26,27 of april missing max_date=32-60 --> 4,5,6,7,11,12,13,14,18,19,20,21,25,26,27,28 of april missing

So maybe I don't understand the logic here. I see a pattern, but I have no idea why this pattern is the desired data that you want returned from your queries...

Please explain.

` // Get the available time periods for every day of this month. $this->load->model('services_model'); $service_duration = (int)$this->services_model->get_value('duration', $service_id); $availabilities_type = (int)$this->services_model->get_value('availabilities_type', $service_id);

        for ($i=1; $i<=$number_of_days; $i++) {
            $current_date = new DateTime($selected_date->format('Y-m') . '-' . $i);

            if ($current_date < new DateTime(date('Y-m-d 00:00:00'))) { // Past dates become immediately unavailable.
                $unavailable_dates[] = $current_date->format('Y-m-d');
                continue;
            }

            //MaxDate mod Craig Tucker 2 start
            if ($current_date > new DateTime(date('Y-m-d 00:00:00', strtotime('+'.$max_date.'days')))) { // Dates past maxDate become immediately unavailable.
                $unavailable_dates[] = $current_date->format('Y-m-d');
                continue;
            }
            //MaxDate mod Craig Tucker 2 end

            $empty_periods = $this->_get_provider_available_time_periods($provider_id,
                    $current_date->format('Y-m-d'));

            $available_hours = $this->_calculate_available_hours($empty_periods, $current_date->format('Y-m-d'),
                    $service_duration, false, $availabilities_type);

            if (empty($available_hours)) {
                $unavailable_dates[] = $current_date->format('Y-m-d');
            }
        }

        echo json_encode($unavailable_dates);`

That code is responsible for returning the "unavailable_dates" via json. On your server it returns the data set that I don't understand and on my server I get memory allocation errors and 0 data returned.

Thanks again for assisting here....

CraigT543 commented 7 years ago

the pattern you are seeing is the pattern of blocked out days. They are the days that are calculated as full. The other days that are not seen are days in the working plan that I am not on. So the only days that will show in the calendar are days that are actually available. I am running nearly fully booked so you see a lot of missing days.

Craig

On 3/27/2017 7:03 PM, bullmoose20 wrote:

So check out this: https://www.craigtuckerlcsw.com/easy/index.php/appointments/ajax_get_unavailable_dates?max_date=10&provider_id=85&service_id=23&selected_date=2017-04-01&csrfToken=bbec398bd8677c7450053bbd1b01c8ed

I manually set the max_date=10 and the selected_date=2017-04-01 in the string on your server and I get: ["2017-04-01","2017-04-02","2017-04-03","2017-04-07","2017-04-08","2017-04-09","2017-04-10","2017-04-11","2017-04-12","2017-04-13","2017-04-14","2017-04-15","2017-04-16","2017-04-17","2017-04-18","2017-04-19","2017-04-20","2017-04-21","2017-04-22","2017-04-23","2017-04-24","2017-04-25","2017-04-26","2017-04-27","2017-04-28","2017-04-29","2017-04-30"]

4th 5th and 6th are missing from the resulting set.

Now I set it to max_date=1: https://www.craigtuckerlcsw.com/easy/index.php/appointments/ajax_get_unavailable_dates?max_date=1&provider_id=85&service_id=23&selected_date=2017-04-01&csrfToken=bbec398bd8677c7450053bbd1b01c8ed

and I get the following: ["2017-04-01","2017-04-02","2017-04-03","2017-04-04","2017-04-05","2017-04-06","2017-04-07","2017-04-08","2017-04-09","2017-04-10","2017-04-11","2017-04-12","2017-04-13","2017-04-14","2017-04-15","2017-04-16","2017-04-17","2017-04-18","2017-04-19","2017-04-20","2017-04-21","2017-04-22","2017-04-23","2017-04-24","2017-04-25","2017-04-26","2017-04-27","2017-04-28","2017-04-29","2017-04-30"] It includes all dates in April. Changing the max_date from 1 to 7 gives the same resulting set. As soon as you change it to 8, you get the following: https://www.craigtuckerlcsw.com/easy/index.php/appointments/ajax_get_unavailable_dates?max_date=8&provider_id=85&service_id=23&selected_date=2017-04-01&csrfToken=bbec398bd8677c7450053bbd1b01c8ed

["2017-04-01","2017-04-02","2017-04-03","2017-04-05","2017-04-06","2017-04-07","2017-04-08","2017-04-09","2017-04-10","2017-04-11","2017-04-12","2017-04-13","2017-04-14","2017-04-15","2017-04-16","2017-04-17","2017-04-18","2017-04-19","2017-04-20","2017-04-21","2017-04-22","2017-04-23","2017-04-24","2017-04-25","2017-04-26","2017-04-27","2017-04-28","2017-04-29","2017-04-30"]

April 4th is missing.

Here is the summary of the string and resulting set of dates progressed from 1-60. max_date=1,2,3,4,5,6,7 --> complete set of dates for april max_date=8 --> 4th of april missing max_date=9 --> 4,5th of april missing max_date=10 --> 4,5,6th of april missing max_date=11 --> 4,5,6,7 of april missing max_date=11,12,13,14 --> 4,5,6,7 of april missing max_date=15 --> 4,5,6,7,11 of april missing max_date=16 --> 4,5,6,7,11,12 of april missing max_date=17 --> 4,5,6,7,11,12,13 of april missing max_date=18,19,20,21 --> 4,5,6,7,11,12,13,14 of april missing max_date=22 --> 4,5,6,7,11,12,13,14,18 of april missing max_date=23 --> 4,5,6,7,11,12,13,14,18,19 of april missing max_date=24 --> 4,5,6,7,11,12,13,14,18,19,20 of april missing max_date=25,26,27,28 --> 4,5,6,7,11,12,13,14,18,19,20,21 of april missing max_date=29 --> 4,5,6,7,11,12,13,14,18,19,20,21,25 of april missing max_date=30 --> 4,5,6,7,11,12,13,14,18,19,20,21,25,26 of april missing max_date=31 --> 4,5,6,7,11,12,13,14,18,19,20,21,25,26,27 of april missing max_date=32-60 --> 4,5,6,7,11,12,13,14,18,19,20,21,25,26,27,28 of april missing

So maybe I don't understand the logic here. I see a pattern, but I have no idea why this pattern is the desired data that you want returned from your queries...

Please explain.

` // Get the available time periods for every day of this month. $this->load->model('services_model'); $service_duration = (int)$this->services_model->get_value('duration', $service_id); $availabilities_type = (int)$this->services_model->get_value('availabilities_type', $service_id);

|for ($i=1; $i<=$number_of_days; $i++) { $current_date = new DateTime($selected_date->format('Y-m') . '-' . $i); if ($current_date < new DateTime(date('Y-m-d 00:00:00'))) { // Past dates become immediately unavailable. $unavailable_dates[] = $current_date->format('Y-m-d'); continue; } //MaxDate mod Craig Tucker 2 start if ($current_date > new DateTime(date('Y-m-d 00:00:00', strtotime('+'.$max_date.'days')))) { // Dates past maxDate become immediately unavailable. $unavailable_dates[] = $current_date->format('Y-m-d'); continue; } //MaxDate mod Craig Tucker 2 end $empty_periods = $this->_get_provider_available_time_periods($provider_id, $current_date->format('Y-m-d')); $available_hours = $this->_calculate_available_hours($empty_periods, $current_date->format('Y-m-d'), $service_duration, false, $availabilities_type); if (empty($available_hours)) { $unavailable_dates[] = $current_date->format('Y-m-d'); } } echo json_encode($unavailable_dates);` |

That code is responsible for returning the "unavailable_dates" via json. On your server it returns the data set that I don't understand and on my server I get memory allocation errors and 0 data returned.

Thanks again for assisting here....

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CraigT543/EasyBlue/issues/3#issuecomment-289640292, or mute the thread https://github.com/notifications/unsubscribe-auth/AKyI7AHtcLSBN2Aplrvw6ApcDA-xSPruks5rqGpugaJpZM4MmNjv.

--

Thank you,

Craig

Craig Tucker, LCSW Logo

•LCS 20312•craigtuckerlcsw@verizon.net mailto:craigtuckerlcsw@verizon.net•www.craigtuckerlcsw.com http://www.craigtuckerlcsw.com/

•333 East Stuart Ave, Suite F, Redlands, CA 92374•Phone (909) 389-2414 • Fax (909) 353-4982•

CONFIDENTIALITY NOTICE: This email transmission, including any attachments that accompany it, may contain confidential information belonging to the sender that is protected by law and is for the exclusive use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, or distribution of information in this transmission, or the taking of any action in reliance on the contents of this transmission, is strictly prohibited. Any unauthorized interception of this transmission is illegal under the law. If you have received this transmission in error, please notify the sender by reply email right away and then destroy all copies of this transmission.