plugin path is now symlink inside docker plugin
This commit is contained in:
9
Makefile
9
Makefile
@@ -24,7 +24,7 @@ RESET = "\e[0m"
|
||||
|
||||
COMPOSE = ./srcs/docker-compose.yml
|
||||
|
||||
VOLUME_PATH = $(shell grep "MAP_VOLUMES" ./srcs/.env | cut -d "=" -f 2)
|
||||
VOLUME_PATH = $(shell grep -w "MAP_VOLUMES" ./srcs/.env | cut -d "=" -f 2)
|
||||
VOLUMES_D = $(VOLUME_PATH)/wp_volume \
|
||||
$(VOLUME_PATH)/db_volume
|
||||
WP_URL = $(shell grep "WP_URL" ./srcs/.env | cut -d "=" -f 2)
|
||||
@@ -74,7 +74,7 @@ clean:
|
||||
docker network prune -f
|
||||
docker system prune -f
|
||||
|
||||
# remove everything
|
||||
# remove everything except local volumes data
|
||||
fclean-images: clean
|
||||
- docker stop $(RUNNING)
|
||||
docker system prune -af
|
||||
@@ -84,5 +84,10 @@ fclean: fclean-images fclean-volumes
|
||||
|
||||
re: fclean all
|
||||
|
||||
# !! remove everything everything
|
||||
erase_v:
|
||||
- rm -rf ${VOLUMES_D}
|
||||
hard: erase_v re
|
||||
|
||||
.PHONY : all $(VOLUMES_D) build up list clean fclean re
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
" ============================================================================
|
||||
" Netrw Directory Listing (netrw v171)
|
||||
" /home/lenovo/42/lejourduprof/srcs/plugins/google_map
|
||||
" Sorted by name
|
||||
" Sort sequence: [\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$
|
||||
" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:special
|
||||
" ==============================================================================
|
||||
../
|
||||
lejourduprof/
|
||||
| .git/
|
||||
| docs/
|
||||
| srcs/
|
||||
| | plugins/
|
||||
| | | google_map/
|
||||
| | | | index.php
|
||||
| | | | script.js
|
||||
| | | | style.css
|
||||
| | | map_prof/
|
||||
| | | | map_prof.php*
|
||||
| | requirements/
|
||||
| | .env
|
||||
| | docker-compose.yml
|
||||
| .gitignore
|
||||
| Makefile
|
||||
| README.md
|
||||
@@ -10,6 +10,7 @@ DB_PSWD="too bad you have read this now i have to erase your memory"
|
||||
|
||||
WP_URL=local_lejourduprof.com
|
||||
WP_DIR=/var/www/html
|
||||
WP_PLUGIN_DIR=/home/www-data/
|
||||
WP_TITLE=title
|
||||
|
||||
WP_ADMIN=hulamy
|
||||
@@ -22,7 +23,8 @@ WP_USER_EMAIL=moehu36@42.fr
|
||||
|
||||
# MAP
|
||||
|
||||
MAX_UPLOAD_SIZE=2046
|
||||
EXECUTION_TIME=2000
|
||||
MAX_UPLOAD_SIZE=512
|
||||
EXECUTION_TIME=300
|
||||
MAP_VOLUMES=/home/lenovo/data/lejourduprof
|
||||
MAP_VOLUMES_PLUGINS=/home/lenovo/42/lejourduprof/srcs/plugins
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ services:
|
||||
networks:
|
||||
- inception
|
||||
volumes:
|
||||
- wp_volume:/var/www/html
|
||||
- wp_plugins:/home/www-data/plugins
|
||||
- wp_volume:${WP_DIR}
|
||||
- wp_plugins:${WP_PLUGIN_DIR}
|
||||
build:
|
||||
context: ./requirements/wordpress
|
||||
args:
|
||||
@@ -91,7 +91,7 @@ volumes:
|
||||
driver_opts:
|
||||
type: none
|
||||
o: "bind"
|
||||
device: /home/lenovo/42/lejourduprof/srcs/plugins
|
||||
device: ${MAP_VOLUMES_PLUGINS}
|
||||
db_volume:
|
||||
driver: local
|
||||
driver_opts:
|
||||
|
||||
29
srcs/plugins/google_map/index.php
Normal file → Executable file
29
srcs/plugins/google_map/index.php
Normal file → Executable file
@@ -10,6 +10,7 @@
|
||||
|
||||
<?php
|
||||
|
||||
// https://www.inkthemes.com/implement-google-map-plugin-for-wodpress/
|
||||
// Error: Publishing failed. The response is not a valid JSON response.
|
||||
// -> https://wordpress.org/support/topic/publishing-failed-error-message-the-response-is-not-a-valid-json-response-2/
|
||||
// - solution permalink -> broken
|
||||
@@ -53,11 +54,25 @@ if(isset($_POST['submit'])){
|
||||
update_option('map_zoom_value', $zoom);
|
||||
}
|
||||
|
||||
add_action( 'init', 'my_script' );
|
||||
function console_log($output, $with_script_tags = true) {
|
||||
$js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) .
|
||||
');';
|
||||
if ($with_script_tags) {
|
||||
$js_code = '<script>' . $js_code . '</script>';
|
||||
}
|
||||
echo $js_code;
|
||||
}
|
||||
|
||||
function my_script() {
|
||||
wp_enqueue_script('my_script', plugins_url('js/script.js', __FILE__), array('jquery'));
|
||||
wp_enqueue_style('my_style', plugins_url('css/style.css', __FILE__));
|
||||
add_action( 'init', 'my_init_script' );
|
||||
|
||||
function my_init_script() {
|
||||
// __FILE__ = "/home/www-data/plugins/google_map/index.php"
|
||||
wp_enqueue_script('my_script', plugins_url('script.js', __FILE__), array('jquery'));
|
||||
console_log( plugins_url('script.js', __FILE__) );
|
||||
wp_enqueue_style('my_style', plugins_url('style.css', __FILE__));
|
||||
console_log( plugins_url('style.css', __FILE__) );
|
||||
console_log( plugin_dir_path(__FILE__) );
|
||||
console_log( plugin_dir_url(__FILE__) );
|
||||
}
|
||||
|
||||
function show_google_map() {
|
||||
@@ -65,14 +80,18 @@ function show_google_map() {
|
||||
$GoogleMap_Latitude = get_option('googleMap_latitude_position');
|
||||
$GoogleMap_Longitude = get_option('googleMap_longitude_position');
|
||||
$GoogleMap_zoom = get_option('map_zoom_value');
|
||||
$File = dirname(__FILE__);
|
||||
$Plugin = plugins_url( 'style.css', __FILE__ );
|
||||
|
||||
?>
|
||||
<script
|
||||
src="http://maps.googleapis.com/maps/api/js?&sensor=false?key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE">
|
||||
src="http://maps.googleapis.com/maps/api/js?&sensor=false?&key=AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE">
|
||||
</script>
|
||||
<div class="latitude"> <?php echo $GoogleMap_Latitude; ?> </div>
|
||||
<div class="longitude" > <?php echo $GoogleMap_Longitude; ?></div>
|
||||
<div class="zoom"> <?php echo $GoogleMap_zoom; ?></div>
|
||||
<div><?php echo $File; ?></div>
|
||||
<div><?php echo $Plugin; ?></div>
|
||||
<div id="showmap"> </div>
|
||||
<?php
|
||||
}
|
||||
|
||||
0
srcs/plugins/google_map/script.js
Normal file → Executable file
0
srcs/plugins/google_map/script.js
Normal file → Executable file
0
srcs/plugins/google_map/style.css
Normal file → Executable file
0
srcs/plugins/google_map/style.css
Normal file → Executable file
@@ -67,5 +67,8 @@ fi
|
||||
chown -R www-data:www-data /var/www/*
|
||||
chmod 755 -R /var/www/*
|
||||
|
||||
# symlinks for folders found in host plugins/
|
||||
# todo
|
||||
|
||||
exec "${PHP_VERSION}" -FR
|
||||
|
||||
|
||||
Reference in New Issue
Block a user